j-templates 8.0.13 → 8.0.14
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/DOM/createAssignment.js +2 -6
- package/DOM/createAttributeAssignment.js +2 -6
- package/DOM/createEventAssignment.js +2 -6
- package/DOM/createPropertyAssignment.js +10 -14
- package/DOM/domNodeConfig.js +27 -30
- package/DOM/elements.js +102 -108
- package/DOM/index.js +3 -19
- package/Node/component.js +12 -16
- package/Node/component.types.js +1 -2
- package/Node/nodeConfig.js +2 -5
- package/Node/vNode.js +64 -67
- package/Node/vNode.types.js +5 -9
- package/Store/Diff/defaultDiffTreeWorker.d.ts +1 -0
- package/Store/Diff/defaultDiffTreeWorker.js +4 -0
- package/Store/Diff/diffAsync.d.ts +2 -4
- package/Store/Diff/diffAsync.js +4 -33
- package/Store/Diff/diffSync.js +3 -10
- package/Store/Diff/diffTree.d.ts +66 -41
- package/Store/Diff/diffTree.js +357 -427
- package/Store/Diff/diffTreeWorker.d.ts +8 -0
- package/Store/Diff/diffTreeWorker.js +27 -0
- package/Store/Diff/workerQueue.js +6 -10
- package/Store/Store/store.js +10 -14
- package/Store/Store/storeAsync.d.ts +1 -2
- package/Store/Store/storeAsync.js +10 -14
- package/Store/Store/storeSync.js +10 -14
- package/Store/Tree/observableNode.js +35 -38
- package/Store/Tree/observableScope.js +35 -42
- package/Store/index.js +5 -13
- package/Utils/animation.js +7 -11
- package/Utils/array.js +2 -6
- package/Utils/asyncQueue.js +7 -11
- package/Utils/decorators.js +44 -53
- package/Utils/emitter.js +6 -9
- package/Utils/functions.js +1 -4
- package/Utils/index.js +3 -21
- package/Utils/injector.js +2 -6
- package/Utils/json.d.ts +32 -10
- package/Utils/json.js +195 -208
- package/Utils/list.js +2 -5
- package/Utils/scheduling.js +4 -7
- package/Utils/thread.js +18 -26
- package/Utils/utils.types.js +1 -2
- package/_not_used/array.js +4 -10
- package/_not_used/avlTree.js +2 -5
- package/index.js +2 -10
- package/package.json +1 -1
- package/Store/Diff/diffWorker.d.ts +0 -3
- package/Store/Diff/diffWorker.js +0 -21
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.InlineScope = InlineScope;
|
|
5
|
-
exports.MappedScope = MappedScope;
|
|
6
|
-
exports.GateScope = GateScope;
|
|
7
|
-
exports.PeekScope = PeekScope;
|
|
8
|
-
const emitter_1 = require("../../Utils/emitter");
|
|
9
|
-
const functions_1 = require("../../Utils/functions");
|
|
10
|
-
const scheduling_1 = require("../../Utils/scheduling");
|
|
1
|
+
import { Emitter } from "../../Utils/emitter";
|
|
2
|
+
import { IsAsync } from "../../Utils/functions";
|
|
3
|
+
import { _queueMicrotask } from "../../Utils/scheduling";
|
|
11
4
|
function Invoke(param, callback) {
|
|
12
5
|
return callback(param);
|
|
13
6
|
}
|
|
@@ -20,7 +13,7 @@ function Invoke(param, callback) {
|
|
|
20
13
|
* @returns A new dynamic observable scope.
|
|
21
14
|
*/
|
|
22
15
|
function CreateDynamicScope(getFunction, greedy, value) {
|
|
23
|
-
const async =
|
|
16
|
+
const async = IsAsync(getFunction);
|
|
24
17
|
const scope = {
|
|
25
18
|
type: "dynamic",
|
|
26
19
|
async,
|
|
@@ -31,7 +24,7 @@ function CreateDynamicScope(getFunction, greedy, value) {
|
|
|
31
24
|
getFunction,
|
|
32
25
|
setCallback: null,
|
|
33
26
|
value,
|
|
34
|
-
emitter:
|
|
27
|
+
emitter: Emitter.Create(),
|
|
35
28
|
emitters: null,
|
|
36
29
|
onUpdated: null,
|
|
37
30
|
onDestroyed: null,
|
|
@@ -45,7 +38,7 @@ function CreateBasicScope(getFunction) {
|
|
|
45
38
|
return {
|
|
46
39
|
type: "basic",
|
|
47
40
|
getFunction,
|
|
48
|
-
emitter:
|
|
41
|
+
emitter: Emitter.Create(),
|
|
49
42
|
destroyed: false
|
|
50
43
|
};
|
|
51
44
|
}
|
|
@@ -78,7 +71,7 @@ function ProcessScopeQueue() {
|
|
|
78
71
|
const value = scope.value;
|
|
79
72
|
ExecuteScope(scope);
|
|
80
73
|
if (scope.value !== value)
|
|
81
|
-
|
|
74
|
+
Emitter.Emit(scope.emitter, scope);
|
|
82
75
|
}
|
|
83
76
|
}
|
|
84
77
|
}
|
|
@@ -90,7 +83,7 @@ function ProcessScopeQueue() {
|
|
|
90
83
|
function OnSetQueued(scope) {
|
|
91
84
|
scopeQueue.push(scope);
|
|
92
85
|
if (scopeQueue.length === 1)
|
|
93
|
-
|
|
86
|
+
_queueMicrotask(ProcessScopeQueue);
|
|
94
87
|
}
|
|
95
88
|
/**
|
|
96
89
|
* Marks a scope as dirty and triggers update behavior based on scope type.
|
|
@@ -105,7 +98,7 @@ function OnSet() {
|
|
|
105
98
|
OnSetQueued(this);
|
|
106
99
|
return;
|
|
107
100
|
}
|
|
108
|
-
|
|
101
|
+
Emitter.Emit(this.emitter, this);
|
|
109
102
|
}
|
|
110
103
|
/**
|
|
111
104
|
* Registers an emitter using SAME_STRATEGY.
|
|
@@ -264,14 +257,14 @@ function ExecuteScope(scope) {
|
|
|
264
257
|
scope.pending = null;
|
|
265
258
|
const lastValue = scope.value;
|
|
266
259
|
scope.value = result;
|
|
267
|
-
scope.onUpdated &&
|
|
268
|
-
|
|
260
|
+
scope.onUpdated && Emitter.Emit(scope.onUpdated, lastValue, scope);
|
|
261
|
+
Emitter.Emit(scope.emitter, scope);
|
|
269
262
|
});
|
|
270
263
|
}
|
|
271
264
|
else {
|
|
272
265
|
const lastValue = scope.value;
|
|
273
266
|
scope.value = state.value;
|
|
274
|
-
scope.onUpdated &&
|
|
267
|
+
scope.onUpdated && Emitter.Emit(scope.onUpdated, lastValue, scope);
|
|
275
268
|
}
|
|
276
269
|
}
|
|
277
270
|
function ExecuteBasicScope(scope) {
|
|
@@ -290,7 +283,7 @@ function ExecuteBasicScope(scope) {
|
|
|
290
283
|
* @returns A new observable scope.
|
|
291
284
|
*/
|
|
292
285
|
function ExecuteFunction(callback, greedy) {
|
|
293
|
-
const async =
|
|
286
|
+
const async = IsAsync(callback);
|
|
294
287
|
const state = WatchFunction(callback, null, null, null);
|
|
295
288
|
if (greedy || async || state.emitters !== null) {
|
|
296
289
|
const scope = CreateDynamicScope(callback, greedy, async ? null : state.value);
|
|
@@ -304,7 +297,7 @@ function ExecuteFunction(callback, greedy) {
|
|
|
304
297
|
return;
|
|
305
298
|
scope.pending = null;
|
|
306
299
|
scope.value = result;
|
|
307
|
-
|
|
300
|
+
Emitter.Emit(scope.emitter, scope);
|
|
308
301
|
});
|
|
309
302
|
}
|
|
310
303
|
return scope;
|
|
@@ -379,7 +372,7 @@ const PEEK_DEFAULT = Symbol("PEEK_DEFAULT");
|
|
|
379
372
|
* @returns The computed value, reusing existing scope if available.
|
|
380
373
|
* @throws Error if called outside a watch context.
|
|
381
374
|
*/
|
|
382
|
-
function InlineScope(callback, idOverride) {
|
|
375
|
+
export function InlineScope(callback, idOverride) {
|
|
383
376
|
if (watchState === null) {
|
|
384
377
|
throw new Error("scope() must be called within a watch context");
|
|
385
378
|
}
|
|
@@ -388,7 +381,7 @@ function InlineScope(callback, idOverride) {
|
|
|
388
381
|
RegisterScope(scope);
|
|
389
382
|
return GetScopeValue(scope);
|
|
390
383
|
}
|
|
391
|
-
function MappedScope(data, callback, onUpdated, onDestroyed) {
|
|
384
|
+
export function MappedScope(data, callback, onUpdated, onDestroyed) {
|
|
392
385
|
if (watchState === null) {
|
|
393
386
|
throw new Error("scope() must be called within a watch context");
|
|
394
387
|
}
|
|
@@ -414,7 +407,7 @@ function MappedScope(data, callback, onUpdated, onDestroyed) {
|
|
|
414
407
|
* @returns The computed value, reusing existing scope if available.
|
|
415
408
|
* @throws Error if called outside a watch context.
|
|
416
409
|
*/
|
|
417
|
-
function GateScope(callback, idOverride) {
|
|
410
|
+
export function GateScope(callback, idOverride) {
|
|
418
411
|
if (watchState === null) {
|
|
419
412
|
throw new Error("gate() must be called within a watch context");
|
|
420
413
|
}
|
|
@@ -443,7 +436,7 @@ function GateScope(callback, idOverride) {
|
|
|
443
436
|
* @returns The computed value, reusing existing scope if available.
|
|
444
437
|
* @throws Error if called outside a watch context.
|
|
445
438
|
*/
|
|
446
|
-
function PeekScope(callback, idOverride) {
|
|
439
|
+
export function PeekScope(callback, idOverride) {
|
|
447
440
|
if (watchState === null) {
|
|
448
441
|
throw new Error("peek() must be called within a watch context");
|
|
449
442
|
}
|
|
@@ -463,32 +456,32 @@ function UpdateEmitters(scope, state) {
|
|
|
463
456
|
return;
|
|
464
457
|
if (scope.emitters === null) {
|
|
465
458
|
for (let x = 0; x < state.emitters.length; x++)
|
|
466
|
-
|
|
459
|
+
Emitter.On(state.emitters[x], scope.setCallback);
|
|
467
460
|
scope.emitters = state.emitters;
|
|
468
461
|
return;
|
|
469
462
|
}
|
|
470
463
|
switch (state.strategy) {
|
|
471
464
|
case SHRINK_STRATEGY: {
|
|
472
465
|
for (let x = state.emitters.length; x < scope.emitters.length; x++)
|
|
473
|
-
|
|
466
|
+
Emitter.Remove(scope.emitters[x], scope.setCallback);
|
|
474
467
|
break;
|
|
475
468
|
}
|
|
476
469
|
case PUSH_STRATEGY: {
|
|
477
470
|
for (let x = state.emitterIndex; x < scope.emitters.length; x++)
|
|
478
471
|
if (!state.emitters.includes(scope.emitters[x], state.emitterIndex))
|
|
479
|
-
|
|
472
|
+
Emitter.Remove(scope.emitters[x], scope.setCallback);
|
|
480
473
|
for (let x = state.emitterIndex; x < state.emitters.length; x++)
|
|
481
474
|
if (!scope.emitters.includes(state.emitters[x], state.emitterIndex))
|
|
482
|
-
|
|
475
|
+
Emitter.On(state.emitters[x], scope.setCallback);
|
|
483
476
|
break;
|
|
484
477
|
}
|
|
485
478
|
case DISTINCT_STRATEGY: {
|
|
486
479
|
for (let x = state.emitterIndex; x < scope.emitters.length; x++)
|
|
487
480
|
if (!state.emitterSet.delete(scope.emitters[x]))
|
|
488
|
-
|
|
481
|
+
Emitter.Remove(scope.emitters[x], scope.setCallback);
|
|
489
482
|
for (let x = state.emitterIndex; x < state.emitters.length; x++)
|
|
490
483
|
if (state.emitterSet.has(state.emitters[x]))
|
|
491
|
-
|
|
484
|
+
Emitter.On(state.emitters[x], scope.setCallback);
|
|
492
485
|
break;
|
|
493
486
|
}
|
|
494
487
|
}
|
|
@@ -525,7 +518,7 @@ function DestroyScope(scope) {
|
|
|
525
518
|
DestroyAllScopes(childScopes);
|
|
526
519
|
if (scope.emitters !== null)
|
|
527
520
|
for (let x = 0; x < scope.emitters.length; x++)
|
|
528
|
-
|
|
521
|
+
Emitter.Remove(scope.emitters[x], scope.setCallback);
|
|
529
522
|
scope.scopes = null;
|
|
530
523
|
scope.mappedScopes = null;
|
|
531
524
|
scope.emitters = null;
|
|
@@ -536,12 +529,12 @@ function DestroyScope(scope) {
|
|
|
536
529
|
case "static": {
|
|
537
530
|
const lastValue = scope.value;
|
|
538
531
|
scope.value = undefined;
|
|
539
|
-
scope.onDestroyed &&
|
|
532
|
+
scope.onDestroyed && Emitter.Emit(scope.onDestroyed, lastValue);
|
|
540
533
|
break;
|
|
541
534
|
}
|
|
542
535
|
}
|
|
543
536
|
}
|
|
544
|
-
var ObservableScope;
|
|
537
|
+
export var ObservableScope;
|
|
545
538
|
(function (ObservableScope) {
|
|
546
539
|
/**
|
|
547
540
|
* Creates a new observable scope from a value function.
|
|
@@ -632,7 +625,7 @@ var ObservableScope;
|
|
|
632
625
|
function Watch(scope, callback) {
|
|
633
626
|
if (!scope || scope.destroyed || scope.type === "static")
|
|
634
627
|
return;
|
|
635
|
-
|
|
628
|
+
Emitter.On(scope.emitter, callback);
|
|
636
629
|
}
|
|
637
630
|
ObservableScope.Watch = Watch;
|
|
638
631
|
/**
|
|
@@ -644,7 +637,7 @@ var ObservableScope;
|
|
|
644
637
|
function Unwatch(scope, callback) {
|
|
645
638
|
if (!scope || scope.destroyed || scope.type === "static")
|
|
646
639
|
return;
|
|
647
|
-
|
|
640
|
+
Emitter.Remove(scope.emitter, callback);
|
|
648
641
|
}
|
|
649
642
|
ObservableScope.Unwatch = Unwatch;
|
|
650
643
|
/**
|
|
@@ -657,8 +650,8 @@ var ObservableScope;
|
|
|
657
650
|
function OnUpdated(scope, callback) {
|
|
658
651
|
if (scope.type !== "dynamic")
|
|
659
652
|
return;
|
|
660
|
-
scope.onUpdated ??=
|
|
661
|
-
|
|
653
|
+
scope.onUpdated ??= Emitter.Create();
|
|
654
|
+
Emitter.On(scope.onUpdated, callback);
|
|
662
655
|
}
|
|
663
656
|
ObservableScope.OnUpdated = OnUpdated;
|
|
664
657
|
/**
|
|
@@ -667,8 +660,8 @@ var ObservableScope;
|
|
|
667
660
|
* @param callback Function to invoke when the scope is destroyed.
|
|
668
661
|
*/
|
|
669
662
|
function OnDestroyed(scope, callback) {
|
|
670
|
-
scope.onDestroyed ??=
|
|
671
|
-
|
|
663
|
+
scope.onDestroyed ??= Emitter.Create();
|
|
664
|
+
Emitter.On(scope.onDestroyed, callback);
|
|
672
665
|
}
|
|
673
666
|
ObservableScope.OnDestroyed = OnDestroyed;
|
|
674
667
|
/**
|
|
@@ -681,7 +674,7 @@ var ObservableScope;
|
|
|
681
674
|
if (!scope || scope.destroyed || scope.type === "static")
|
|
682
675
|
return;
|
|
683
676
|
if (scope.type === "basic") {
|
|
684
|
-
|
|
677
|
+
Emitter.Emit(scope.emitter, scope);
|
|
685
678
|
return;
|
|
686
679
|
}
|
|
687
680
|
scope.setCallback();
|
|
@@ -704,4 +697,4 @@ var ObservableScope;
|
|
|
704
697
|
DestroyAllScopes(scopes);
|
|
705
698
|
}
|
|
706
699
|
ObservableScope.DestroyAll = DestroyAll;
|
|
707
|
-
})(ObservableScope || (
|
|
700
|
+
})(ObservableScope || (ObservableScope = {}));
|
package/Store/index.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var storeSync_1 = require("./Store/storeSync");
|
|
7
|
-
Object.defineProperty(exports, "StoreSync", { enumerable: true, get: function () { return storeSync_1.StoreSync; } });
|
|
8
|
-
var storeAsync_1 = require("./Store/storeAsync");
|
|
9
|
-
Object.defineProperty(exports, "StoreAsync", { enumerable: true, get: function () { return storeAsync_1.StoreAsync; } });
|
|
10
|
-
var observableScope_1 = require("./Tree/observableScope");
|
|
11
|
-
Object.defineProperty(exports, "ObservableScope", { enumerable: true, get: function () { return observableScope_1.ObservableScope; } });
|
|
12
|
-
var observableNode_1 = require("./Tree/observableNode");
|
|
13
|
-
Object.defineProperty(exports, "ObservableNode", { enumerable: true, get: function () { return observableNode_1.ObservableNode; } });
|
|
1
|
+
export { Store } from "./Store/store";
|
|
2
|
+
export { StoreSync } from "./Store/storeSync";
|
|
3
|
+
export { StoreAsync } from "./Store/storeAsync";
|
|
4
|
+
export { ObservableScope } from "./Tree/observableScope";
|
|
5
|
+
export { ObservableNode } from "./Tree/observableNode";
|
package/Utils/animation.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Animation = exports.AnimationType = void 0;
|
|
4
|
-
const nodeConfig_1 = require("../Node/nodeConfig");
|
|
1
|
+
import { NodeConfig } from "../Node/nodeConfig";
|
|
5
2
|
var StepFunctions;
|
|
6
3
|
(function (StepFunctions) {
|
|
7
4
|
function EaseIn(start, duration) {
|
|
@@ -23,15 +20,15 @@ var StepFunctions;
|
|
|
23
20
|
/**
|
|
24
21
|
* Supported animation functions.
|
|
25
22
|
*/
|
|
26
|
-
var AnimationType;
|
|
23
|
+
export var AnimationType;
|
|
27
24
|
(function (AnimationType) {
|
|
28
25
|
AnimationType[AnimationType["Linear"] = 0] = "Linear";
|
|
29
26
|
AnimationType[AnimationType["EaseIn"] = 1] = "EaseIn";
|
|
30
|
-
})(AnimationType || (
|
|
27
|
+
})(AnimationType || (AnimationType = {}));
|
|
31
28
|
/**
|
|
32
29
|
* Class for handling interpolation for basic animations.
|
|
33
30
|
*/
|
|
34
|
-
class Animation {
|
|
31
|
+
export class Animation {
|
|
35
32
|
/**
|
|
36
33
|
* Is the animation currently running.
|
|
37
34
|
*/
|
|
@@ -70,7 +67,7 @@ class Animation {
|
|
|
70
67
|
this.enabled = true;
|
|
71
68
|
this.type = type;
|
|
72
69
|
this.animationDuration = duration;
|
|
73
|
-
this.animationUpdate =
|
|
70
|
+
this.animationUpdate = NodeConfig.wrapPriorityUpdates(update);
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
76
73
|
* Start an animation. Calls the passed `update` callback for each animation frame
|
|
@@ -105,13 +102,13 @@ class Animation {
|
|
|
105
102
|
const next = this.start + step;
|
|
106
103
|
this.animationUpdate(next);
|
|
107
104
|
if (percent < 1)
|
|
108
|
-
|
|
105
|
+
NodeConfig.scheduleUpdate(this.animationRun);
|
|
109
106
|
else {
|
|
110
107
|
resolve();
|
|
111
108
|
}
|
|
112
109
|
};
|
|
113
110
|
this.animationRun = animationRun;
|
|
114
|
-
|
|
111
|
+
NodeConfig.scheduleUpdate(this.animationRun);
|
|
115
112
|
}).then(() => {
|
|
116
113
|
this.Cancel();
|
|
117
114
|
});
|
|
@@ -145,4 +142,3 @@ class Animation {
|
|
|
145
142
|
this.Disable();
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
|
-
exports.Animation = Animation;
|
package/Utils/array.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RemoveNulls = RemoveNulls;
|
|
4
|
-
exports.ArraysEqual = ArraysEqual;
|
|
5
1
|
/**
|
|
6
2
|
* Removes all null values from an array starting from a specified index.
|
|
7
3
|
* This function modifies the array in-place by shifting non-null elements
|
|
@@ -19,7 +15,7 @@ exports.ArraysEqual = ArraysEqual;
|
|
|
19
15
|
* RemoveNulls(arr2, 2); // Starts from index 2, result: [null, null, 1, 2]
|
|
20
16
|
* ```
|
|
21
17
|
*/
|
|
22
|
-
function RemoveNulls(array, startIndex = 0) {
|
|
18
|
+
export function RemoveNulls(array, startIndex = 0) {
|
|
23
19
|
let nullIndex = startIndex;
|
|
24
20
|
for (; nullIndex < array.length && array[nullIndex] !== null; nullIndex++) { }
|
|
25
21
|
let notNullIndex = nullIndex + 1;
|
|
@@ -33,7 +29,7 @@ function RemoveNulls(array, startIndex = 0) {
|
|
|
33
29
|
if (nullIndex < array.length)
|
|
34
30
|
array.splice(nullIndex);
|
|
35
31
|
}
|
|
36
|
-
function ArraysEqual(left, right) {
|
|
32
|
+
export function ArraysEqual(left, right) {
|
|
37
33
|
let equal = left === right || left?.length === right?.length;
|
|
38
34
|
for (let x = 0; equal && x < left.length; x++)
|
|
39
35
|
equal = left[x] === right[x];
|
package/Utils/asyncQueue.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AsyncQueue = void 0;
|
|
4
|
-
const list_1 = require("./list");
|
|
1
|
+
import { List } from "./list";
|
|
5
2
|
/**
|
|
6
3
|
* A queue that executes async callbacks sequentially, one at a time.
|
|
7
4
|
*/
|
|
8
|
-
class AsyncQueue {
|
|
5
|
+
export class AsyncQueue {
|
|
9
6
|
constructor() {
|
|
10
7
|
this.running = false;
|
|
11
|
-
this.queue =
|
|
8
|
+
this.queue = List.Create();
|
|
12
9
|
}
|
|
13
10
|
Flush() {
|
|
14
11
|
const ret = new Promise(resolve => {
|
|
15
|
-
|
|
12
|
+
List.Add(this.queue, resolve);
|
|
16
13
|
});
|
|
17
14
|
this.Start();
|
|
18
15
|
return ret;
|
|
@@ -25,7 +22,7 @@ class AsyncQueue {
|
|
|
25
22
|
*/
|
|
26
23
|
Next(callback) {
|
|
27
24
|
const ret = new Promise((resolve, reject) => {
|
|
28
|
-
|
|
25
|
+
List.Add(this.queue, async function () {
|
|
29
26
|
try {
|
|
30
27
|
const ret = await callback();
|
|
31
28
|
resolve(ret);
|
|
@@ -42,7 +39,7 @@ class AsyncQueue {
|
|
|
42
39
|
* Clears the queue and stops execution.
|
|
43
40
|
*/
|
|
44
41
|
Stop() {
|
|
45
|
-
|
|
42
|
+
List.Clear(this.queue);
|
|
46
43
|
}
|
|
47
44
|
/**
|
|
48
45
|
* Starts queue execution if not already running.
|
|
@@ -59,7 +56,7 @@ class AsyncQueue {
|
|
|
59
56
|
* @private
|
|
60
57
|
*/
|
|
61
58
|
async ExecuteQueue() {
|
|
62
|
-
const callback =
|
|
59
|
+
const callback = List.Pop(this.queue);
|
|
63
60
|
if (callback !== undefined) {
|
|
64
61
|
await callback();
|
|
65
62
|
this.ExecuteQueue();
|
|
@@ -68,4 +65,3 @@ class AsyncQueue {
|
|
|
68
65
|
this.running = false;
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
exports.AsyncQueue = AsyncQueue;
|