efront 4.0.23 → 4.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coms/basic_/Promise.js +31 -34
- package/coms/basic_/Promise_test.js +1 -0
- package/coms/zimoli/cross.js +3 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic_/Promise.js
CHANGED
|
@@ -18,14 +18,11 @@ if (!Promise) {
|
|
|
18
18
|
var queue = [];
|
|
19
19
|
var running = false;
|
|
20
20
|
var run = function (q) {
|
|
21
|
-
running = true;
|
|
22
21
|
while (queue.length) {
|
|
23
22
|
var threads = queue.splice(0, queue.length);
|
|
24
23
|
for (var t of threads) {
|
|
25
|
-
if (!t.oked && !t.ohed) continue;
|
|
26
24
|
var PromiseRejectReactions = t.PromiseRejectReactions.splice(0, t.PromiseRejectReactions.length);
|
|
27
25
|
var PromiseFulfillReactions = t.PromiseFulfillReactions.splice(0, t.PromiseFulfillReactions.length);
|
|
28
|
-
|
|
29
26
|
if (t.oked) {
|
|
30
27
|
for (var r of PromiseFulfillReactions) {
|
|
31
28
|
r.call(null, t.oked[0]);
|
|
@@ -49,8 +46,9 @@ if (!Promise) {
|
|
|
49
46
|
running = false;
|
|
50
47
|
};
|
|
51
48
|
var fire = function (p) {
|
|
52
|
-
if (running) return queue.push(p);
|
|
53
49
|
queue.push(p);
|
|
50
|
+
if (running) return;
|
|
51
|
+
running = true;
|
|
54
52
|
requestAnimationFrame(run);
|
|
55
53
|
};
|
|
56
54
|
var Promise = function (executor) {
|
|
@@ -72,39 +70,38 @@ if (!Promise) {
|
|
|
72
70
|
p.ohed = arguments;
|
|
73
71
|
fire(p);
|
|
74
72
|
};
|
|
75
|
-
fire(p);
|
|
76
73
|
executor(ResolvingFunctions_resolve, ResolvingFunctions_reject);
|
|
77
74
|
};
|
|
78
|
-
Promise.prototype = {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"catch"(f) {
|
|
105
|
-
return this.then(null, f);
|
|
106
|
-
},
|
|
75
|
+
Promise.prototype.then = function (onok, onoh) {
|
|
76
|
+
var resolve, reject;
|
|
77
|
+
var promise = new Promise(function (ok, oh) {
|
|
78
|
+
if (onok) resolve = function (a) {
|
|
79
|
+
try {
|
|
80
|
+
a = onok(a);
|
|
81
|
+
ok(a);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
oh(e, onok, onoh);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
else resolve = ok;
|
|
87
|
+
if (onoh) reject = function (a) {
|
|
88
|
+
try {
|
|
89
|
+
a = onoh.apply(null, arguments);
|
|
90
|
+
ok(a);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
oh(e, onok, onoh);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
else reject = oh;
|
|
96
|
+
})
|
|
97
|
+
if (resolve) this.PromiseFulfillReactions.push(resolve);
|
|
98
|
+
if (reject) this.PromiseRejectReactions.push(reject);
|
|
99
|
+
if (this.oked || this.ohed) fire(this);
|
|
100
|
+
return promise;
|
|
107
101
|
}
|
|
102
|
+
Promise.prototype.catch = function (f) {
|
|
103
|
+
return this.then(null, f);
|
|
104
|
+
};
|
|
108
105
|
Promise.all = function (penddings) {
|
|
109
106
|
return new Promise(function (ok, oh) {
|
|
110
107
|
if (!(penddings && penddings.length)) {
|
package/coms/zimoli/cross.js
CHANGED
|
@@ -18,7 +18,9 @@ if (cookiesData) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
var digest = function () {
|
|
21
|
-
|
|
21
|
+
Promise.resolve().then(function(){
|
|
22
|
+
dispatch('render', window);
|
|
23
|
+
});
|
|
22
24
|
};
|
|
23
25
|
if (/Trident/i.test(navigator.userAgent)) digest = lazy(digest, 60);
|
|
24
26
|
var cross = cross_.bind(function (callback, onerror) {
|