Fix the initial scene readiness check to actually work.
[pwl6.git] / src / yuu / core.js
index 8b16707..25d3ed2 100644 (file)
             initOptions = options || {};
             yuu.log("messages", "Initializing Yuu engine.");
             var promises = [];
-            yf.each(function (hook) {
-                promises.push(hook.call(yuu, initOptions));
-            }, initHooks);
+            // initHooks can be pushed to while iterating, so iterate
+            // by index, not a foreach loop.
+            for (var i = 0; i < initHooks.length; ++i)
+                promises.push(initHooks[i].call(yuu, initOptions));
             initHooks = null; // Bust future registerInitHook calls.
             yuu.log("messages", "Initialization hooks complete.");
             if (gui) {