targetj 1.0.234 → 1.0.236

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.
@@ -18,7 +18,11 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
18
18
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
19
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
20
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
21
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
22
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
23
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
24
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
25
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
22
26
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
23
27
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
28
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -495,9 +499,61 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
495
499
  }
496
500
  if (tmodel.isNowInvisible) {
497
501
  this.addToLocationList(tmodel);
502
+ this.pauseSchedules(tmodel);
503
+ }
504
+ if (tmodel.isNowVisible) {
505
+ this.resumeSchedules(tmodel);
498
506
  }
499
507
  tmodel.addToParentVisibleChildren();
500
508
  }
509
+ }, {
510
+ key: "pauseSchedules",
511
+ value: function pauseSchedules(tmodel) {
512
+ if (tmodel.type === 'BI') {
513
+ return;
514
+ }
515
+ var keys = new Set([].concat(_toConsumableArray(tmodel.activeTargetList), _toConsumableArray(tmodel.updatingTargetList)));
516
+ var _iterator = _createForOfIteratorHelper(keys),
517
+ _step;
518
+ try {
519
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
520
+ var key = _step.value;
521
+ var target = tmodel.targets[key];
522
+ if (_TUtil.TUtil.isDefined(tmodel.getScheduleTimeStamp(key)) && (target === null || target === void 0 ? void 0 : target.pauseOn) === 'hidden') {
523
+ _TUtil.TUtil.pauseSchedule(tmodel, key);
524
+ }
525
+ }
526
+ } catch (err) {
527
+ _iterator.e(err);
528
+ } finally {
529
+ _iterator.f();
530
+ }
531
+ }
532
+ }, {
533
+ key: "resumeSchedules",
534
+ value: function resumeSchedules(tmodel) {
535
+ if (tmodel.type === 'BI') {
536
+ return;
537
+ }
538
+ var keys = new Set([].concat(_toConsumableArray(tmodel.activeTargetList), _toConsumableArray(tmodel.updatingTargetList)));
539
+ var _iterator2 = _createForOfIteratorHelper(keys),
540
+ _step2;
541
+ try {
542
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
543
+ var key = _step2.value;
544
+ var target = tmodel.targets[key];
545
+ var remaining = tmodel.getScheduleRemainingTime(key);
546
+ if (_TUtil.TUtil.isDefined(remaining) && (target === null || target === void 0 ? void 0 : target.pauseOn) === 'hidden') {
547
+ _TUtil.TUtil.resumeSchedule(tmodel, key);
548
+ (0, _App.getRunScheduler)().schedule(remaining, 'resume-' + tmodel.oid + '-' + key);
549
+ }
550
+ }
551
+ } catch (err) {
552
+ _iterator2.e(err);
553
+ } finally {
554
+ _iterator2.f();
555
+ }
556
+ }
501
557
  }, {
502
558
  key: "calculateTargets",
503
559
  value: function calculateTargets(tmodel) {
@@ -512,17 +568,17 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
512
568
  while (tmodel.activatedTargets.length && guard++ < 50) {
513
569
  var batch = tmodel.activatedTargets.slice(0);
514
570
  tmodel.activatedTargets.length = 0;
515
- var _iterator = _createForOfIteratorHelper(batch),
516
- _step;
571
+ var _iterator3 = _createForOfIteratorHelper(batch),
572
+ _step3;
517
573
  try {
518
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
519
- var key = _step.value;
574
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
575
+ var key = _step3.value;
520
576
  (0, _App.getTargetManager)().applyTargetValue(tmodel, key);
521
577
  }
522
578
  } catch (err) {
523
- _iterator.e(err);
579
+ _iterator3.e(err);
524
580
  } finally {
525
- _iterator.f();
581
+ _iterator3.f();
526
582
  }
527
583
  }
528
584
  (0, _App.getTargetManager)().applyTargetValues(tmodel);
@@ -561,11 +617,11 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
561
617
  var list = _this2.resumePausedList.slice();
562
618
  _this2.resumePausedList.length = 0;
563
619
  _this2.resumePausedMap = {};
564
- var _iterator2 = _createForOfIteratorHelper(list),
565
- _step2;
620
+ var _iterator4 = _createForOfIteratorHelper(list),
621
+ _step4;
566
622
  try {
567
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
568
- var tmodel = _step2.value;
623
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
624
+ var tmodel = _step4.value;
569
625
  var batch = tmodel.pausedBatch;
570
626
  if (!batch || !tmodel.hasDom()) {
571
627
  continue;
@@ -577,9 +633,9 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
577
633
  }
578
634
  }
579
635
  } catch (err) {
580
- _iterator2.e(err);
636
+ _iterator4.e(err);
581
637
  } finally {
582
- _iterator2.f();
638
+ _iterator4.f();
583
639
  }
584
640
  });
585
641
  });
@@ -591,20 +647,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
591
647
  if ((externalEventMap === null || externalEventMap === void 0 ? void 0 : externalEventMap.size) > 0) {
592
648
  var eventTargets = [];
593
649
  var eventMap = _TargetData.TargetData.allEventMap;
594
- var _iterator3 = _createForOfIteratorHelper(externalEventMap),
595
- _step3;
650
+ var _iterator5 = _createForOfIteratorHelper(externalEventMap),
651
+ _step5;
596
652
  try {
597
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
598
- var _step3$value = _slicedToArray(_step3.value, 1),
599
- targetName = _step3$value[0];
653
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
654
+ var _step5$value = _slicedToArray(_step5.value, 1),
655
+ targetName = _step5$value[0];
600
656
  if (eventMap[targetName](tmodel)) {
601
657
  eventTargets.push(tmodel.allTargetMap[targetName]);
602
658
  }
603
659
  }
604
660
  } catch (err) {
605
- _iterator3.e(err);
661
+ _iterator5.e(err);
606
662
  } finally {
607
- _iterator3.f();
663
+ _iterator5.f();
608
664
  }
609
665
  this.runEventTargets(tmodel, eventTargets);
610
666
  }
@@ -616,20 +672,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
616
672
  var eventMap = _TargetData.TargetData.internalEventMap;
617
673
  var internalEventMap = tmodel.internalEventMap;
618
674
  if ((internalEventMap === null || internalEventMap === void 0 ? void 0 : internalEventMap.size) > 0) {
619
- var _iterator4 = _createForOfIteratorHelper(internalEventMap),
620
- _step4;
675
+ var _iterator6 = _createForOfIteratorHelper(internalEventMap),
676
+ _step6;
621
677
  try {
622
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
623
- var _step4$value = _slicedToArray(_step4.value, 1),
624
- targetName = _step4$value[0];
678
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
679
+ var _step6$value = _slicedToArray(_step6.value, 1),
680
+ targetName = _step6$value[0];
625
681
  if (eventMap[targetName](tmodel)) {
626
682
  eventTargets.push(tmodel.allTargetMap[targetName]);
627
683
  }
628
684
  }
629
685
  } catch (err) {
630
- _iterator4.e(err);
686
+ _iterator6.e(err);
631
687
  } finally {
632
- _iterator4.f();
688
+ _iterator6.f();
633
689
  }
634
690
  }
635
691
  this.runEventTargets(tmodel, eventTargets);
@@ -162,7 +162,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
162
162
  value: function onPageClose() {
163
163
  _App.tApp.resizeLastUpdate = _TUtil.TUtil.now();
164
164
  (0, _App.getEvents)().resizeRoot();
165
- _App.tApp.manager.getVisibles().forEach(function (tmodel) {
165
+ _App.tApp.manager.getAvailableDoms().forEach(function (tmodel) {
166
166
  (0, _App.getLocationManager)().runEventTargets(tmodel, ['onPageClose']);
167
167
  });
168
168
  }
@@ -98,19 +98,11 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
98
98
  var insertTime = _TUtil.TUtil.now();
99
99
  this.delayRun(effectiveDelay, runId, insertTime);
100
100
  }
101
- }, {
102
- key: "timeSchedule",
103
- value: function timeSchedule(delay, runId) {
104
- if (!_App.tApp.isRunning() || this.resetting) {
105
- return;
106
- }
107
- this.delayRun(delay, runId, _TUtil.TUtil.now());
108
- }
109
101
  }, {
110
102
  key: "run",
111
103
  value: function () {
112
104
  var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(delay, runId) {
113
- var _this$delayProcess;
105
+ var handedOff;
114
106
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
115
107
  while (1) switch (_context2.prev = _context2.next) {
116
108
  case 0:
@@ -133,53 +125,56 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
133
125
  this.runId = runId;
134
126
  this.runningFlag = true;
135
127
  this.runStartTime = _TUtil.TUtil.now();
136
- if (_App.tApp.debugLevel === 1) {
137
- _TUtil.TUtil.log(true)("Request from: ".concat(runId, " delay: ").concat(delay, " runningStep:").concat(this.runningStep, " dom:").concat(this.domProcessing, " runs:").concat(this.nextRuns.length, " D:").concat((_this$delayProcess = this.delayProcess) === null || _this$delayProcess === void 0 ? void 0 : _this$delayProcess.delay, " events:").concat((0, _App.getEvents)().eventQueue.length));
138
- }
128
+ handedOff = false;
129
+ _context2.prev = 10;
139
130
  if (!(this.phase === 0)) {
140
- _context2.next = 16;
131
+ _context2.next = 17;
141
132
  break;
142
133
  }
143
134
  (0, _App.getEvents)().captureEvents();
144
135
  _App.tApp.targetManager.applyTargetValues((0, _App.tRoot)());
145
- _context2.next = 15;
136
+ _context2.next = 16;
146
137
  return (0, _App.getLocationManager)().calculateAll();
147
- case 15:
148
- this.phase = 1;
149
138
  case 16:
139
+ this.phase = 1;
140
+ case 17:
150
141
  if (!(_TUtil.TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
151
- _context2.next = 19;
142
+ _context2.next = 21;
152
143
  break;
153
144
  }
145
+ handedOff = true;
154
146
  this.requestNextSlice(runId);
155
147
  return _context2.abrupt("return");
156
- case 19:
148
+ case 21:
157
149
  if (this.phase === 1) {
158
150
  this.runningStep = _App.tApp.manager.analyze();
159
151
  this.phase = 2;
160
152
  }
161
153
  if (!(_TUtil.TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
162
- _context2.next = 23;
154
+ _context2.next = 26;
163
155
  break;
164
156
  }
157
+ handedOff = true;
165
158
  this.requestNextSlice(runId);
166
159
  return _context2.abrupt("return");
167
- case 23:
160
+ case 26:
168
161
  if (this.phase === 2) {
169
162
  (0, _App.getLocationManager)().calculateActivated();
170
163
  _App.tApp.events.resetEventsOnTimeout();
171
164
  this.phase = 3;
172
165
  }
173
166
  if (!(_TUtil.TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
174
- _context2.next = 27;
167
+ _context2.next = 31;
175
168
  break;
176
169
  }
170
+ handedOff = true;
177
171
  this.requestNextSlice(runId);
178
172
  return _context2.abrupt("return");
179
- case 27:
173
+ case 31:
180
174
  if (this.phase === 3) {
181
175
  if (this.runningStep >= 0) {
182
176
  if (this.domProcessing === 0) {
177
+ handedOff = true;
183
178
  this.domOperations(this.runningStep);
184
179
  } else if (!this.rerunId) {
185
180
  this.rerunId = "domrun ".concat(runId);
@@ -191,11 +186,24 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
191
186
  if (this.domProcessing === 0) {
192
187
  this.needsRerun();
193
188
  }
194
- case 30:
189
+ _context2.next = 40;
190
+ break;
191
+ case 36:
192
+ _context2.prev = 36;
193
+ _context2.t0 = _context2["catch"](10);
194
+ this.phase = 0;
195
+ throw _context2.t0;
196
+ case 40:
197
+ _context2.prev = 40;
198
+ if (!handedOff && this.domProcessing === 0) {
199
+ this.runningFlag = false;
200
+ }
201
+ return _context2.finish(40);
202
+ case 43:
195
203
  case "end":
196
204
  return _context2.stop();
197
205
  }
198
- }, _callee2, this);
206
+ }, _callee2, this, [[10, 36, 40, 43]]);
199
207
  }));
200
208
  function run(_x, _x2) {
201
209
  return _run.apply(this, arguments);
@@ -213,7 +221,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
213
221
  this.sliceQueued = true;
214
222
  requestAnimationFrame(function () {
215
223
  _this.sliceQueued = false;
216
- _this.delayRun(0, "slice-".concat(runId), _TUtil.TUtil.now());
224
+ _this.schedule(0, "slice-".concat(runId));
217
225
  });
218
226
  }
219
227
  }, {
@@ -225,35 +233,32 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
225
233
  var id = this.rerunId;
226
234
  this.rerunId = '';
227
235
  this.schedule(0, "rerun-".concat(id));
228
- return;
229
- }
230
- var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime) : undefined;
231
- if (newDelay === undefined || (0, _App.getManager)().lists.activeTModels.length > 0 || (0, _App.getManager)().lists.updatingTModels.length > 0 || (0, _App.getManager)().lists.restyle.length > 0 || (0, _App.getManager)().lists.reasyncStyle.length > 0 || (0, _App.getEvents)().eventQueue.length > 0 || (0, _App.getLocationManager)().activatedList.length > 0) {
232
- if ((0, _App.getEvents)().eventQueue.length > 0) {
233
- this.schedule(1, "events-".concat((0, _App.getEvents)().eventQueue.length));
234
- } else if ((0, _App.getLocationManager)().activatedList.length > 0) {
235
- this.schedule(1, "getManager-locationManager-activatedList");
236
- } else if ((0, _App.getManager)().lists.updatingTModels.length > 0) {
237
- this.schedule(1, "getManager-needsRerun-updatingTModels");
238
- } else if ((0, _App.getManager)().lists.activeTModels.length > 0) {
239
- var activeTModel = (0, _App.getManager)().lists.activeTModels.find(function (tmodel) {
240
- return tmodel.targetExecutionCount === 0 || tmodel.activeTargetList.filter(function (target) {
241
- return !tmodel.isScheduledPending(target);
242
- }).some(function (target) {
243
- return tmodel.shouldScheduleRun(target);
236
+ } else if ((0, _App.getEvents)().eventQueue.length > 0) {
237
+ this.schedule(0, "events-".concat((0, _App.getEvents)().eventQueue.length));
238
+ } else {
239
+ var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime) : undefined;
240
+ if (newDelay === undefined || (0, _App.getManager)().lists.activeTModels.length > 0 || (0, _App.getManager)().lists.updatingTModels.length > 0 || (0, _App.getManager)().lists.restyle.length > 0 || (0, _App.getManager)().lists.reasyncStyle.length > 0 || (0, _App.getEvents)().eventQueue.length > 0 || (0, _App.getLocationManager)().activatedList.length > 0) {
241
+ if ((0, _App.getLocationManager)().activatedList.length > 0) {
242
+ this.schedule(1, "getManager-locationManager-activatedList");
243
+ } else if ((0, _App.getManager)().lists.updatingTModels.length > 0) {
244
+ this.schedule(1, "getManager-needsRerun-updatingTModels");
245
+ } else if ((0, _App.getManager)().lists.activeTModels.length > 0) {
246
+ var activeTModel = (0, _App.getManager)().lists.activeTModels.find(function (tmodel) {
247
+ return tmodel.targetExecutionCount === 0 || tmodel.activeTargetList.filter(function (target) {
248
+ return !tmodel.isScheduledPending(target);
249
+ }).some(function (target) {
250
+ return tmodel.shouldScheduleRun(target);
251
+ });
244
252
  });
245
- });
246
- if (activeTModel) {
247
- var delay = !this.activeStartTime || _TUtil.TUtil.now() - this.activeStartTime > 15 ? 1 : 15;
248
- this.activeStartTime = _TUtil.TUtil.now();
249
- this.schedule(delay, "getManager-needsRerun-".concat(activeTModel.oid, "-").concat(activeTModel.activeTargetList));
253
+ if (activeTModel) {
254
+ var delay = !this.activeStartTime || _TUtil.TUtil.now() - this.activeStartTime > 15 ? 1 : 15;
255
+ this.activeStartTime = _TUtil.TUtil.now();
256
+ this.schedule(delay, "getManager-needsRerun-".concat(activeTModel.oid, "-").concat(activeTModel.activeTargetList));
257
+ }
250
258
  }
251
259
  }
252
260
  }
253
- if (!this.delayProcess && this.nextRuns.length > 0) {
254
- var _delay = Math.max(1, this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime));
255
- this.schedule(_delay, "wake-nextRun");
256
- }
261
+ this.executeNextRun();
257
262
  }
258
263
  }, {
259
264
  key: "domOperations",
@@ -262,20 +267,23 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
262
267
  this.domProcessing = 1;
263
268
  if (runningStep === 10) {
264
269
  this.domFixStyles();
265
- } else {
266
- Promise.all(RunScheduler.domSteps.filter(function (_, index) {
267
- return index >= runningStep;
268
- }).map(function (step) {
269
- return Promise.resolve().then(step);
270
- })).then(function () {
271
- if ((0, _App.getManager)().lists.restyle.length) {
272
- _this2.domFixStyles();
273
- } else {
274
- _this2.domProcessing = 0;
275
- _this2.needsRerun();
276
- }
277
- });
270
+ return;
278
271
  }
272
+ Promise.all(RunScheduler.domSteps.filter(function (_, index) {
273
+ return index >= runningStep;
274
+ }).map(function (step) {
275
+ return Promise.resolve().then(step);
276
+ })).then(function () {
277
+ if ((0, _App.getManager)().lists.restyle.length) {
278
+ _this2.domFixStyles();
279
+ return;
280
+ }
281
+ _this2.domProcessing = 0;
282
+ _this2.needsRerun();
283
+ }).catch(function () {
284
+ _this2.domProcessing = 0;
285
+ _this2.needsRerun();
286
+ });
279
287
  }
280
288
  }, {
281
289
  key: "domFixStyles",
@@ -283,16 +291,19 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
283
291
  var _this3 = this;
284
292
  this.domProcessing = 2;
285
293
  requestAnimationFrame(function () {
286
- (0, _App.getManager)().fixStyles();
287
- _this3.domProcessing = 0;
288
- _this3.needsRerun();
294
+ try {
295
+ (0, _App.getManager)().fixStyles();
296
+ } finally {
297
+ _this3.domProcessing = 0;
298
+ _this3.needsRerun();
299
+ }
289
300
  });
290
301
  }
291
302
  }, {
292
303
  key: "clearDelayProcess",
293
304
  value: function clearDelayProcess() {
294
- var _this$delayProcess2;
295
- if ((_this$delayProcess2 = this.delayProcess) !== null && _this$delayProcess2 !== void 0 && _this$delayProcess2.timeoutId) {
305
+ var _this$delayProcess;
306
+ if ((_this$delayProcess = this.delayProcess) !== null && _this$delayProcess !== void 0 && _this$delayProcess.timeoutId) {
296
307
  clearTimeout(this.delayProcess.timeoutId);
297
308
  this.delayProcess.timeoutId = undefined;
298
309
  }
@@ -310,53 +321,78 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
310
321
  delay: delay,
311
322
  timeoutId: undefined
312
323
  };
313
- delayProcess.timeoutId = setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
314
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
315
- while (1) switch (_context3.prev = _context3.next) {
316
- case 0:
317
- if (!(_this4.delayProcess !== delayProcess)) {
318
- _context3.next = 2;
319
- break;
320
- }
321
- return _context3.abrupt("return");
322
- case 2:
323
- delayProcess.timeoutId = undefined;
324
- _context3.next = 5;
325
- return _this4.run(delay, runId);
326
- case 5:
327
- if (_this4.delayProcess === delayProcess) {
324
+ var execute = /*#__PURE__*/function () {
325
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
326
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
327
+ while (1) switch (_context3.prev = _context3.next) {
328
+ case 0:
329
+ if (!(_this4.delayProcess !== delayProcess)) {
330
+ _context3.next = 2;
331
+ break;
332
+ }
333
+ return _context3.abrupt("return");
334
+ case 2:
335
+ _this4.clearDelayProcess();
336
+ _context3.prev = 3;
337
+ _context3.next = 6;
338
+ return _this4.run(delay, runId);
339
+ case 6:
340
+ _context3.prev = 6;
328
341
  _this4.executeNextRun();
329
- }
330
- case 6:
331
- case "end":
332
- return _context3.stop();
333
- }
334
- }, _callee3);
335
- })), Math.max(0, delay));
342
+ return _context3.finish(6);
343
+ case 9:
344
+ case "end":
345
+ return _context3.stop();
346
+ }
347
+ }, _callee3, null, [[3,, 6, 9]]);
348
+ }));
349
+ return function execute() {
350
+ return _ref.apply(this, arguments);
351
+ };
352
+ }();
336
353
  this.delayProcess = delayProcess;
354
+ delayProcess.timeoutId = setTimeout(execute, delay);
337
355
  }
338
356
  }, {
339
357
  key: "executeNextRun",
340
358
  value: function executeNextRun() {
341
- var lastNegativeRun = null;
342
- var nextValidRun = null;
359
+ if (this.runningFlag || this.domProcessing > 0) {
360
+ return;
361
+ }
362
+ if (this.delayProcess) {
363
+ if (this.nextRuns.length > 0) {
364
+ var nextRun = this.nextRuns[0];
365
+ var nextRunTime = nextRun.insertTime + nextRun.delay;
366
+ if (nextRunTime < this.delayProcess.runTime) {
367
+ clearTimeout(this.delayProcess.timeoutId);
368
+ var remaining = Math.max(0, this.delayProcess.runTime - _TUtil.TUtil.now());
369
+ this.insertRun(this.delayProcess.runId, _TUtil.TUtil.now(), remaining);
370
+ this.delayProcess = undefined;
371
+ } else {
372
+ return;
373
+ }
374
+ } else {
375
+ return;
376
+ }
377
+ }
378
+ var runToExecute = null;
343
379
  while (this.nextRuns.length > 0) {
344
- var nextRun = this.nextRuns.shift();
380
+ var _nextRun = this.nextRuns.shift();
345
381
  var now = _TUtil.TUtil.now();
346
- var newDelay = nextRun.delay - (now - nextRun.insertTime);
347
- if (newDelay < 0) {
348
- lastNegativeRun = nextRun;
382
+ var newDelay = _nextRun.delay - (now - _nextRun.insertTime);
383
+ if (newDelay <= 0) {
384
+ runToExecute = _nextRun;
349
385
  } else {
350
- lastNegativeRun = null;
351
- nextValidRun = nextRun;
386
+ this.nextRuns.unshift(_nextRun);
352
387
  break;
353
388
  }
354
389
  }
355
- if (lastNegativeRun) {
356
- this.setDelayProcess(lastNegativeRun.runId, lastNegativeRun.insertTime, lastNegativeRun.delay, _TUtil.TUtil.now(), 0);
357
- } else if (nextValidRun) {
390
+ if (runToExecute) {
391
+ this.setDelayProcess(runToExecute.runId, runToExecute.insertTime, runToExecute.delay, _TUtil.TUtil.now(), 0);
392
+ } else if (this.nextRuns.length > 0) {
393
+ var nextValidRun = this.nextRuns[0];
358
394
  var _now = _TUtil.TUtil.now();
359
- var _newDelay = Math.max(1, nextValidRun.delay - (_now - nextValidRun.insertTime));
395
+ var _newDelay = Math.max(0, nextValidRun.delay - (_now - nextValidRun.insertTime));
360
396
  this.setDelayProcess(nextValidRun.runId, nextValidRun.insertTime, nextValidRun.delay, _now + _newDelay, _newDelay);
361
397
  } else {
362
398
  this.clearDelayProcess();
@@ -386,7 +422,13 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
386
422
  var r = this.nextRuns[mid];
387
423
  var diffTime = r.insertTime + r.delay - (newInsertTime + newDelay);
388
424
  if (diffTime === 0) {
389
- r.runId += '-' + newRunId;
425
+ var _r$count;
426
+ r.count = ((_r$count = r.count) !== null && _r$count !== void 0 ? _r$count : 1) + 1;
427
+ if (r.runId.length < 500) {
428
+ r.runId += '-' + newRunId;
429
+ } else if (!r.runId.endsWith('-...')) {
430
+ r.runId += '-...';
431
+ }
390
432
  return;
391
433
  }
392
434
  if (diffTime > 0) {