소스 검색

Merge branch 'fix/o2-promise-all' into 'wrdp'

修复o2.promiseAll方法

See merge request o2oa/o2oa!2735
胡起 5 년 전
부모
커밋
ef1d8f7efd
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  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") })){
             if (p.some(function(e){ return (e && o2.typeOf(e.then)=="function") })){
                 return Promise.all(p);
                 return Promise.all(p);
             }else{
             }else{
-                //return { "then": function(s){ return s(p) || this;} };
-                return new Promise(function(s){s(p); return this;});
+                return { "then": function(s){ if (s) s(p); return this;} };
+                //return new Promise(function(s){s(p); return this;});
             }
             }
         }else{
         }else{
             if (p && o2.typeOf(p.then)=="function"){
             if (p && o2.typeOf(p.then)=="function"){
                 return Promise.resolve(p);
                 return Promise.resolve(p);
             }else{
             }else{
-                //return { "then": function(s){ return s(p) || this;} };
-                return new Promise(function(s){s(p); return this;});
+                return { "then": function(s){ if (s) s(p); return this;} };
+                //return new Promise(function(s){s(p); return this;});
             }
             }
         }
         }
         // var method = (o2.typeOf(p)=="array") ? "all" : "resolve";
         // var method = (o2.typeOf(p)=="array") ? "all" : "resolve";