Explorar el Código

Tiny fix for promise polyfill.all([])

David Catuhe hace 7 años
padre
commit
3067636619
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      src/Tools/babylon.promise.ts

+ 7 - 2
src/Tools/babylon.promise.ts

@@ -200,10 +200,15 @@ module BABYLON {
             agregator.target = promises.length;
             agregator.rootPromise = newPromise;
 
-            for(var index = 0; index < promises.length; index++) {
-                InternalPromise._RegisterForFulfillment(promises[index], agregator, index);
+            if (promises.length) {
+                for(var index = 0; index < promises.length; index++) {
+                    InternalPromise._RegisterForFulfillment(promises[index], agregator, index);
+                }
+            } else {
+                newPromise._resolve();
             }
 
+
             return newPromise;
         }
     }