Bladeren bron

修复o2.promiseAll方法

huqi 5 jaren geleden
bovenliggende
commit
986dc6e688
1 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 4 4
      o2web/source/o2_core/o2.js

+ 4 - 4
o2web/source/o2_core/o2.js

@@ -1897,15 +1897,15 @@ if (!window.Promise){
             if (p.some(function(e){ return (e && o2.typeOf(e.then)=="function") })){
                 return Promise.all(p);
             }else{
-                return { "then": function(s){ return s(p) || this;} };
-                //return new Promise(function(s){s(p); return this;});
+                //return { "then": function(s){ return s(p) || this;} };
+                return new Promise(function(s){s(p); return this;});
             }
         }else{
             if (p && o2.typeOf(p.then)=="function"){
                 return Promise.resolve(p);
             }else{
-                return { "then": function(s){ return s(p) || this;} };
-                //return new Promise(function(s){s(p); return this;});
+                //return { "then": function(s){ return s(p) || this;} };
+                return new Promise(function(s){s(p); return this;});
             }
         }
         // var method = (o2.typeOf(p)=="array") ? "all" : "resolve";