[Jifty-commit] r7400 - jifty/trunk/share/web/static/js

Jifty commits jifty-commit at lists.jifty.org
Mon Aug 17 23:57:30 EDT 2009


Author: sartak
Date: Mon Aug 17 23:57:30 2009
New Revision: 7400

Modified:
   jifty/trunk/share/web/static/js/jifty.js

Log:
If preloading is queued, queue up preloads :)

Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js	(original)
+++ jifty/trunk/share/web/static/js/jifty.js	Mon Aug 17 23:57:30 2009
@@ -1553,6 +1553,13 @@
 // Are we currently preloading a given preload_key?
 Jifty.preloading_regions = {};
 
+// Are we submitting an action? If so, delay preloading.
+Jifty.preloading_is_queued = 0;
+
+// A cache of preloads to execute once we have a response to the action
+// we submitted
+Jifty.queued_preloads = [];
+
 // For when we want a preloading region to be processed immediately (e.g. when
 // we click a preloaded button)
 Jifty.want_preloaded_regions = {};
@@ -1563,6 +1570,15 @@
         return;
     }
 
+    // We're waiting for an action. We don't want to preload any more regions
+    // until we know that action has been executed.
+    if (Jifty.preloading_is_queued) {
+        Jifty.queued_preloads.push(function () {
+            Jifty.preload(args, trigger);
+        });
+        return;
+    }
+
     // Preloading is supposed to be silent
     args.hide_wait_message = 1;
 


More information about the Jifty-commit mailing list