Author: simoneg
Date: Thu Jul 15 06:32:02 2010
New Revision: 964311

URL: http://svn.apache.org/viewvc?rev=964311&view=rev
Log:
Small batching of multiple requests

Modified:
    
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js

Modified: 
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js?rev=964311&r1=964310&r2=964311&view=diff
==============================================================================
--- 
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js
 (original)
+++ 
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js
 Thu Jul 15 06:32:02 2010
@@ -162,6 +162,26 @@ magma.autoajax = new function() {
         */
        this.renew = function(stateId) {
                var me = this;
+               if (!me.torenew || me.torenew.length == 0) {
+                       setTimeout('magma.autoajax._intrenew()', 200);
+                       me.torenew = new Array();
+               }
+               for (var i = 0; i < me.torenew.length; i++) {
+                       if (me.torenew[i] == stateId) return;
+               }
+               me.torenew.push(stateId);
+       }
+       
+       this._intrenew = function() {
+               var me = this;
+               if (!me.torenew || me.torenew.length == 0) {
+                       delete me.torenew;
+                       return;
+               }
+               // TODO better batching asing the server multiple parts
+               var stateId = me.torenew[0];
+               me.torenew.splice(0,1);
+               setTimeout('magma.autoajax._intrenew()', 200);          
                var stategrp = this.state.elements[stateId];
                var jqele = jQuery(stategrp.domElement);
                var event = jQuery.Event("renewing");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to