efront 3.35.2 → 3.35.3

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.
@@ -1,7 +1,7 @@
1
1
  if (Promise) {
2
2
  var SafePromise = void 0;
3
3
  Promise.resolve({
4
- then() {
4
+ get then() {
5
5
  SafePromise = Promise;
6
6
  }
7
7
  });
@@ -2,6 +2,7 @@ var window = this;
2
2
  var Array = window.Array;
3
3
  var setTimeout = window.setTimeout;
4
4
  var Function = window.Function;
5
+ var Object = window.Object;
5
6
  var console = window.console;
6
7
  var navigator = window.navigator;
7
8
  var requestAnimationFrame = window.setImmediate || window.setTimeout;
@@ -15,33 +16,40 @@ if (!Promise) {
15
16
  return pendding instanceof Promise || pendding && isFunction(pendding.then);
16
17
  };
17
18
  var queue = [];
19
+ var running = false;
18
20
  var run = function (q) {
19
- var threads = queue.splice(0, queue.length);
20
- for (var t of threads) {
21
- if (t.oked) {
22
- for (var r of t.PromiseFulfillReactions) {
23
- r.call(null, t.oked[0]);
24
- }
25
- }
26
- if (t.ohed) {
27
- var throwed = t.throwed;
28
- t.throwed = true;
29
- if (!throwed && !t.PromiseRejectReactions.length) {
30
- // <!--
31
- console.warn("在异步过程中发现未处理的异常:", t.ohed[0], t.ohed[1], t.ohed[2]);
32
- // -->
33
- throw t.ohed[0];
21
+ running = true;
22
+ while (queue.length) {
23
+ var threads = queue.splice(0, queue.length);
24
+ for (var t of threads) {
25
+ if (!t.oked && !t.ohed) continue;
26
+ var PromiseRejectReactions = t.PromiseRejectReactions.splice(0, t.PromiseRejectReactions.length);
27
+ var PromiseFulfillReactions = t.PromiseFulfillReactions.splice(0, t.PromiseFulfillReactions.length);
28
+
29
+ if (t.oked) {
30
+ for (var r of PromiseFulfillReactions) {
31
+ r.call(null, t.oked[0]);
32
+ }
34
33
  }
35
- for (var r of t.PromiseRejectReactions) {
36
- r.apply(null, t.ohed);
34
+ if (t.ohed) {
35
+ var throwed = t.throwed;
36
+ t.throwed = true;
37
+ if (!throwed && PromiseRejectReactions.length) {
38
+ // <!--
39
+ console.warn("在异步过程中发现未处理的异常:", t.ohed[0], t.ohed[1], t.ohed[2]);
40
+ // -->
41
+ throw t.ohed[0];
42
+ }
43
+ for (var r of PromiseRejectReactions) {
44
+ r.apply(null, t.ohed);
45
+ }
37
46
  }
38
47
  }
39
- t.PromiseRejectReactions.splice(0, t.PromiseRejectReactions.length);
40
- t.PromiseFulfillReactions.splice(0, t.PromiseFulfillReactions.length);
41
48
  }
49
+ running = false;
42
50
  };
43
51
  var fire = function (p) {
44
- if (queue.length) return queue.push(p);
52
+ if (running) return queue.push(p);
45
53
  queue.push(p);
46
54
  requestAnimationFrame(run);
47
55
  };
@@ -59,12 +67,12 @@ if (!Promise) {
59
67
  fire(p);
60
68
  }
61
69
  };
62
-
63
70
  var ResolvingFunctions_reject = function (e) { //oh
64
71
  if (p.oked || p.ohed) return;
65
72
  p.ohed = arguments;
66
73
  fire(p);
67
74
  };
75
+ fire(p);
68
76
  executor(ResolvingFunctions_resolve, ResolvingFunctions_reject);
69
77
  };
70
78
  Promise.prototype = {
@@ -147,5 +155,4 @@ if (!Promise) {
147
155
  ok.apply(null, args);
148
156
  });
149
157
  };
150
-
151
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.35.2",
3
+ "version": "3.35.3",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {