j-templates 7.0.50 → 7.0.52
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/createPropertyAssignment.js +1 -1
- package/Store/Tree/observableNode.d.ts +1 -0
- package/Store/Tree/observableNode.js +9 -0
- package/Store/Tree/observableScope.d.ts +7 -8
- package/Store/Tree/observableScope.js +45 -26
- package/Utils/decorators.js +9 -9
- package/Utils/distinctArray.d.ts +5 -3
- package/Utils/distinctArray.js +20 -11
- package/Utils/injector.d.ts +1 -1
- package/Utils/injector.js +12 -10
- package/Utils/thread.js +9 -5
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ function AssignValue(target, value) {
|
|
|
37
37
|
const start = target.selectionStart;
|
|
38
38
|
const end = target.selectionEnd;
|
|
39
39
|
target.value = value;
|
|
40
|
-
if (target.ownerDocument.activeElement
|
|
40
|
+
if (target.ownerDocument.activeElement === target)
|
|
41
41
|
target.setSelectionRange(start, end);
|
|
42
42
|
}
|
|
43
43
|
function AssignClassName(target, value) {
|
|
@@ -3,6 +3,7 @@ export declare const IS_OBSERVABLE_NODE = "____isObservableNode";
|
|
|
3
3
|
export declare const GET_OBSERVABLE_VALUE = "____getObservableValue";
|
|
4
4
|
export declare const GET_TO_JSON = "toJSON";
|
|
5
5
|
export declare namespace ObservableNode {
|
|
6
|
+
function BypassProxy(value: boolean): void;
|
|
6
7
|
function Create<T>(value: T): T;
|
|
7
8
|
function Touch(value: unknown, prop?: string | number): void;
|
|
8
9
|
function ApplyDiff(rootNode: any, diffResult: JsonDiffResult): void;
|
|
@@ -4,6 +4,7 @@ exports.ObservableNode = exports.GET_TO_JSON = exports.GET_OBSERVABLE_VALUE = ex
|
|
|
4
4
|
const json_1 = require("../../Utils/json");
|
|
5
5
|
const jsonType_1 = require("../../Utils/jsonType");
|
|
6
6
|
const observableScope_1 = require("./observableScope");
|
|
7
|
+
let bypassProxy = false;
|
|
7
8
|
exports.IS_OBSERVABLE_NODE = "____isObservableNode";
|
|
8
9
|
exports.GET_OBSERVABLE_VALUE = "____getObservableValue";
|
|
9
10
|
exports.GET_TO_JSON = "toJSON";
|
|
@@ -146,6 +147,8 @@ function CreateProxyFactory(alias) {
|
|
|
146
147
|
const scope = scopeCache.get(array);
|
|
147
148
|
array = observableScope_1.ObservableScope.Value(scope);
|
|
148
149
|
const arrayValue = array[prop];
|
|
150
|
+
if (bypassProxy)
|
|
151
|
+
return arrayValue;
|
|
149
152
|
if (typeof prop === "symbol")
|
|
150
153
|
return arrayValue;
|
|
151
154
|
if (typeof arrayValue === "function")
|
|
@@ -221,6 +224,8 @@ function CreateProxyFactory(alias) {
|
|
|
221
224
|
case exports.GET_OBSERVABLE_VALUE:
|
|
222
225
|
return object;
|
|
223
226
|
default: {
|
|
227
|
+
if (bypassProxy)
|
|
228
|
+
return object[prop];
|
|
224
229
|
return GetAccessorValue(object, prop);
|
|
225
230
|
}
|
|
226
231
|
}
|
|
@@ -259,6 +264,10 @@ function CreateProxyFactory(alias) {
|
|
|
259
264
|
const DefaultCreateProxy = CreateProxyFactory();
|
|
260
265
|
var ObservableNode;
|
|
261
266
|
(function (ObservableNode) {
|
|
267
|
+
function BypassProxy(value) {
|
|
268
|
+
bypassProxy = value;
|
|
269
|
+
}
|
|
270
|
+
ObservableNode.BypassProxy = BypassProxy;
|
|
262
271
|
function Create(value) {
|
|
263
272
|
return DefaultCreateProxy(value);
|
|
264
273
|
}
|
|
@@ -24,11 +24,9 @@ export declare class ObservableScope<T> extends ObservableScopeWrapper<T> {
|
|
|
24
24
|
(): T | Promise<T>;
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
interface
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
value: T;
|
|
27
|
+
interface ICalcObservable<T> {
|
|
28
|
+
id: string;
|
|
29
|
+
scope: IObservableScope<T>;
|
|
32
30
|
}
|
|
33
31
|
export interface IObservableScope<T> extends IDestroyable {
|
|
34
32
|
getFunction: {
|
|
@@ -41,15 +39,16 @@ export interface IObservableScope<T> extends IDestroyable {
|
|
|
41
39
|
dirty: boolean;
|
|
42
40
|
emitter: Emitter;
|
|
43
41
|
emitters: (Emitter | null)[];
|
|
44
|
-
|
|
42
|
+
calcScopes: ICalcObservable<unknown>[] | null;
|
|
43
|
+
calc: boolean;
|
|
45
44
|
onDestroyed: Emitter | null;
|
|
46
45
|
destroyed: boolean;
|
|
47
46
|
}
|
|
48
|
-
export declare function CalcScope<T>(callback: () => T):
|
|
47
|
+
export declare function CalcScope<T>(callback: () => T): any;
|
|
49
48
|
export declare namespace ObservableScope {
|
|
50
49
|
function Create<T>(valueFunction: {
|
|
51
50
|
(): T | Promise<T>;
|
|
52
|
-
}): IObservableScope<T>;
|
|
51
|
+
}, calc?: boolean): IObservableScope<T>;
|
|
53
52
|
function Register(emitter: Emitter): void;
|
|
54
53
|
function Init<T>(scope: IObservableScope<T>): void;
|
|
55
54
|
function Peek<T>(scope: IObservableScope<T>): T;
|
|
@@ -51,25 +51,42 @@ exports.ObservableScope = ObservableScope;
|
|
|
51
51
|
let watchState = null;
|
|
52
52
|
function WatchScope(scope) {
|
|
53
53
|
const parent = watchState;
|
|
54
|
-
watchState = [[],
|
|
54
|
+
watchState = [[], scope.calcScopes, null];
|
|
55
55
|
const value = scope.getFunction();
|
|
56
56
|
const emitters = watchState[0];
|
|
57
|
-
|
|
58
|
-
const
|
|
57
|
+
UpdateEmitters(scope, emitters);
|
|
58
|
+
const calcScopes = watchState[1];
|
|
59
|
+
for (let x = 0; calcScopes && x < calcScopes.length; x++)
|
|
60
|
+
ObservableScope.Destroy(calcScopes[x]?.scope);
|
|
61
|
+
scope.calcScopes = watchState[2];
|
|
59
62
|
watchState = parent;
|
|
60
|
-
return
|
|
63
|
+
return value;
|
|
61
64
|
}
|
|
62
65
|
function CalcScope(callback) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
if (watchState === null)
|
|
67
|
+
return callback();
|
|
68
|
+
watchState[2] ??= [];
|
|
69
|
+
const currentScopes = watchState[1];
|
|
70
|
+
const id = callback.toString();
|
|
71
|
+
if (currentScopes !== null) {
|
|
72
|
+
let index = 0;
|
|
73
|
+
for (; currentScopes[index].id !== id; index++) { }
|
|
74
|
+
if (index < currentScopes.length) {
|
|
75
|
+
const scope = currentScopes[index];
|
|
76
|
+
currentScopes[index] = null;
|
|
77
|
+
watchState[2].push(scope);
|
|
78
|
+
return ObservableScope.Value(scope.scope);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const scope = ObservableScope.Create(callback, true);
|
|
82
|
+
watchState[2].push({
|
|
83
|
+
id,
|
|
84
|
+
scope,
|
|
85
|
+
});
|
|
86
|
+
return ObservableScope.Value(scope);
|
|
70
87
|
}
|
|
71
88
|
(function (ObservableScope) {
|
|
72
|
-
function Create(valueFunction) {
|
|
89
|
+
function Create(valueFunction, calc = false) {
|
|
73
90
|
const scope = {
|
|
74
91
|
getFunction: valueFunction,
|
|
75
92
|
value: null,
|
|
@@ -78,9 +95,10 @@ function CalcScope(callback) {
|
|
|
78
95
|
dirty: true,
|
|
79
96
|
emitter: emitter_1.Emitter.Create(),
|
|
80
97
|
emitters: null,
|
|
81
|
-
|
|
82
|
-
|
|
98
|
+
calcScopes: null,
|
|
99
|
+
calc,
|
|
83
100
|
destroyed: false,
|
|
101
|
+
onDestroyed: null,
|
|
84
102
|
setCallback: function () {
|
|
85
103
|
return OnSet(scope);
|
|
86
104
|
},
|
|
@@ -156,14 +174,15 @@ function CalcScope(callback) {
|
|
|
156
174
|
function DirtyScope(scope) {
|
|
157
175
|
if (scope.dirty || !scope.getFunction)
|
|
158
176
|
return;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (!scope.dirty)
|
|
177
|
+
if (scope.calc) {
|
|
178
|
+
const startVal = scope.value;
|
|
179
|
+
scope.dirty = true;
|
|
180
|
+
UpdateValue(scope);
|
|
181
|
+
if (startVal !== scope.value)
|
|
182
|
+
emitter_1.Emitter.Emit(scope.emitter);
|
|
166
183
|
return;
|
|
184
|
+
}
|
|
185
|
+
scope.dirty = true;
|
|
167
186
|
if (scope.async) {
|
|
168
187
|
UpdateValue(scope);
|
|
169
188
|
}
|
|
@@ -185,7 +204,7 @@ function ProcessScopeQueue() {
|
|
|
185
204
|
function OnSet(scope) {
|
|
186
205
|
if (scope.destroyed)
|
|
187
206
|
return true;
|
|
188
|
-
if (scope.async || scope.
|
|
207
|
+
if (scope.async || scope.calc) {
|
|
189
208
|
if (scopeQueue.length === 0)
|
|
190
209
|
queueMicrotask(ProcessScopeQueue);
|
|
191
210
|
scopeQueue.push(scope);
|
|
@@ -197,7 +216,7 @@ function UpdateValue(scope) {
|
|
|
197
216
|
if (!scope.dirty)
|
|
198
217
|
return;
|
|
199
218
|
scope.dirty = false;
|
|
200
|
-
const
|
|
219
|
+
const value = WatchScope(scope);
|
|
201
220
|
if (scope.async) {
|
|
202
221
|
scope.promise = value.then(function (result) {
|
|
203
222
|
if (scope.destroyed)
|
|
@@ -209,10 +228,9 @@ function UpdateValue(scope) {
|
|
|
209
228
|
}
|
|
210
229
|
else
|
|
211
230
|
scope.value = value;
|
|
212
|
-
scope.calcFunctions = calcFunctions;
|
|
213
|
-
UpdateEmitters(scope, emitters);
|
|
214
231
|
}
|
|
215
232
|
function UpdateEmitters(scope, right) {
|
|
233
|
+
emitter_1.Emitter.Distinct(right);
|
|
216
234
|
if (scope.emitters === null) {
|
|
217
235
|
for (let x = 0; x < right.length; x++)
|
|
218
236
|
emitter_1.Emitter.On(right[x], scope.setCallback);
|
|
@@ -241,7 +259,8 @@ function DestroyScope(scope) {
|
|
|
241
259
|
scope.emitter = null;
|
|
242
260
|
scope.getFunction = null;
|
|
243
261
|
scope.setCallback = null;
|
|
244
|
-
scope.
|
|
262
|
+
for (let x = 0; scope.calcScopes && x < scope.calcScopes.length; x++)
|
|
263
|
+
ObservableScope.Destroy(scope.calcScopes[x].scope);
|
|
245
264
|
scope.destroyed = true;
|
|
246
265
|
scope.onDestroyed !== null && emitter_1.Emitter.Emit(scope.onDestroyed);
|
|
247
266
|
}
|
package/Utils/decorators.js
CHANGED
|
@@ -50,17 +50,17 @@ function ComputedDecorator(target, prop, descriptor, defaultValue) {
|
|
|
50
50
|
const syncStore = new Store_1.StoreSync();
|
|
51
51
|
observableScope_1.ObservableScope.Watch(getterScope, (scope) => {
|
|
52
52
|
const data = observableScope_1.ObservableScope.Value(scope);
|
|
53
|
-
syncStore.Write(data,
|
|
53
|
+
syncStore.Write(data, "root");
|
|
54
54
|
});
|
|
55
55
|
observableScope_1.ObservableScope.Init(getterScope);
|
|
56
|
-
const propertyScope = observableScope_1.ObservableScope.Create(() => syncStore.Get(
|
|
56
|
+
const propertyScope = observableScope_1.ObservableScope.Create(() => syncStore.Get("root", defaultValue));
|
|
57
57
|
observableScope_1.ObservableScope.OnDestroyed(propertyScope, function () {
|
|
58
58
|
observableScope_1.ObservableScope.Destroy(getterScope);
|
|
59
59
|
});
|
|
60
60
|
scopeMap[propertyKey] = [propertyScope, undefined];
|
|
61
61
|
}
|
|
62
62
|
return observableScope_1.ObservableScope.Value(scopeMap[propertyKey][0]);
|
|
63
|
-
}
|
|
63
|
+
},
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
function ComputedAsync(defaultValue) {
|
|
@@ -81,13 +81,13 @@ function ComputedAsyncDecorator(target, prop, descriptor, defaultValue) {
|
|
|
81
81
|
get: function () {
|
|
82
82
|
const scopeMap = GetScopeMapForInstance(this);
|
|
83
83
|
if (scopeMap[propertyKey] === undefined) {
|
|
84
|
-
const getterScope = observableScope_1.ObservableScope.Create(
|
|
84
|
+
const getterScope = observableScope_1.ObservableScope.Create(() => getter.call(this));
|
|
85
85
|
const asyncStore = new Store_1.StoreAsync();
|
|
86
86
|
observableScope_1.ObservableScope.Watch(getterScope, (scope) => {
|
|
87
|
-
asyncStore.Write(observableScope_1.ObservableScope.Value(scope),
|
|
87
|
+
asyncStore.Write(observableScope_1.ObservableScope.Value(scope), "root");
|
|
88
88
|
});
|
|
89
89
|
observableScope_1.ObservableScope.Init(getterScope);
|
|
90
|
-
const propertyScope = observableScope_1.ObservableScope.Create(() => asyncStore.Get(
|
|
90
|
+
const propertyScope = observableScope_1.ObservableScope.Create(() => asyncStore.Get("root", defaultValue));
|
|
91
91
|
observableScope_1.ObservableScope.OnDestroyed(propertyScope, function () {
|
|
92
92
|
observableScope_1.ObservableScope.Destroy(getterScope);
|
|
93
93
|
asyncStore.Destroy();
|
|
@@ -95,7 +95,7 @@ function ComputedAsyncDecorator(target, prop, descriptor, defaultValue) {
|
|
|
95
95
|
scopeMap[propertyKey] = [propertyScope, undefined];
|
|
96
96
|
}
|
|
97
97
|
return observableScope_1.ObservableScope.Value(scopeMap[propertyKey][0]);
|
|
98
|
-
}
|
|
98
|
+
},
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
function State() {
|
|
@@ -113,7 +113,7 @@ function StateDecorator(target, propertyKey) {
|
|
|
113
113
|
set: function (val) {
|
|
114
114
|
const map = GetNodeMapForInstance(this);
|
|
115
115
|
if (map[propertyKey] === undefined)
|
|
116
|
-
map[propertyKey]
|
|
116
|
+
map[propertyKey] ??= observableNode_1.ObservableNode.Create({ root: val });
|
|
117
117
|
else
|
|
118
118
|
map[propertyKey].root = val;
|
|
119
119
|
},
|
|
@@ -133,7 +133,7 @@ function ValueDecorator(target, propertyKey) {
|
|
|
133
133
|
enumerable: true,
|
|
134
134
|
get: function () {
|
|
135
135
|
const propertyMap = GetScopeMapForInstance(this);
|
|
136
|
-
const tuple = propertyMap[propertyKey] ??= [null, undefined];
|
|
136
|
+
const tuple = (propertyMap[propertyKey] ??= [null, undefined]);
|
|
137
137
|
tuple[0] ??= CreateValueScope(tuple);
|
|
138
138
|
return observableScope_1.ObservableScope.Value(tuple[0]);
|
|
139
139
|
},
|
package/Utils/distinctArray.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export type DistinctArray<T> = {
|
|
2
|
-
id: (value: T) =>
|
|
3
|
-
distinct:
|
|
2
|
+
id: (value: T) => unknown;
|
|
3
|
+
distinct: Set<unknown> | null;
|
|
4
4
|
array: T[];
|
|
5
5
|
};
|
|
6
6
|
export declare namespace DistinctArray {
|
|
7
|
-
function Create<T>(id
|
|
7
|
+
function Create<T>(id?: (value: T) => unknown): DistinctArray<T>;
|
|
8
8
|
function Push<T>(distinctArr: DistinctArray<T>, value: T): void;
|
|
9
9
|
function Get<T>({ array }: DistinctArray<T>): T[];
|
|
10
|
+
function Size<T>(distinct: DistinctArray<T>): number;
|
|
11
|
+
function Clear<T>(distinct: DistinctArray<T>): void;
|
|
10
12
|
}
|
package/Utils/distinctArray.js
CHANGED
|
@@ -3,31 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DistinctArray = void 0;
|
|
4
4
|
var DistinctArray;
|
|
5
5
|
(function (DistinctArray) {
|
|
6
|
-
function Create(id) {
|
|
6
|
+
function Create(id = (val) => val) {
|
|
7
7
|
return {
|
|
8
8
|
id,
|
|
9
9
|
distinct: null,
|
|
10
|
-
array: []
|
|
10
|
+
array: [],
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
DistinctArray.Create = Create;
|
|
14
14
|
function Push(distinctArr, value) {
|
|
15
|
-
|
|
16
|
-
switch (array.length) {
|
|
15
|
+
switch (distinctArr.array.length) {
|
|
17
16
|
case 0:
|
|
18
|
-
array.push(value);
|
|
17
|
+
distinctArr.array.push(value);
|
|
19
18
|
break;
|
|
20
19
|
case 1: {
|
|
21
20
|
if (distinctArr.distinct === null) {
|
|
22
|
-
distinctArr.distinct = [
|
|
23
|
-
|
|
21
|
+
distinctArr.distinct = new Set([
|
|
22
|
+
distinctArr.id(distinctArr.array[0]),
|
|
23
|
+
]);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
default: {
|
|
27
|
-
const vId = id(value);
|
|
28
|
-
if (distinctArr.distinct
|
|
29
|
-
distinctArr.distinct
|
|
30
|
-
array.push(value);
|
|
27
|
+
const vId = distinctArr.id(value);
|
|
28
|
+
if (!distinctArr.distinct.has(vId)) {
|
|
29
|
+
distinctArr.distinct.add(vId);
|
|
30
|
+
distinctArr.array.push(value);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -37,4 +37,13 @@ var DistinctArray;
|
|
|
37
37
|
return array;
|
|
38
38
|
}
|
|
39
39
|
DistinctArray.Get = Get;
|
|
40
|
+
function Size(distinct) {
|
|
41
|
+
return distinct.distinct.size;
|
|
42
|
+
}
|
|
43
|
+
DistinctArray.Size = Size;
|
|
44
|
+
function Clear(distinct) {
|
|
45
|
+
distinct.array = [];
|
|
46
|
+
distinct.distinct?.clear();
|
|
47
|
+
}
|
|
48
|
+
DistinctArray.Clear = Clear;
|
|
40
49
|
})(DistinctArray || (exports.DistinctArray = DistinctArray = {}));
|
package/Utils/injector.d.ts
CHANGED
package/Utils/injector.js
CHANGED
|
@@ -7,15 +7,14 @@ class Injector {
|
|
|
7
7
|
this.typeMap = new Map();
|
|
8
8
|
}
|
|
9
9
|
Get(type) {
|
|
10
|
-
if (this.typeMap.
|
|
11
|
-
return this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ret = this.parent && this.parent.Get(type);
|
|
15
|
-
return ret;
|
|
10
|
+
if (this.typeMap.has(type)) {
|
|
11
|
+
return this.typeMap.get(type);
|
|
12
|
+
}
|
|
13
|
+
return this.parent ? this.parent.Get(type) : undefined;
|
|
16
14
|
}
|
|
17
15
|
Set(type, instance) {
|
|
18
16
|
this.typeMap.set(type, instance);
|
|
17
|
+
return instance;
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
exports.Injector = Injector;
|
|
@@ -26,11 +25,14 @@ exports.Injector = Injector;
|
|
|
26
25
|
}
|
|
27
26
|
Injector.Current = Current;
|
|
28
27
|
function Scope(injector, action, ...args) {
|
|
29
|
-
|
|
28
|
+
const parent = Current();
|
|
30
29
|
scope = injector;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
try {
|
|
31
|
+
return action(...args);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
scope = parent;
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
Injector.Scope = Scope;
|
|
36
38
|
})(Injector || (exports.Injector = Injector = {}));
|
package/Utils/thread.js
CHANGED
|
@@ -19,7 +19,7 @@ function timeRemaining() {
|
|
|
19
19
|
function createDeadline() {
|
|
20
20
|
return {
|
|
21
21
|
end: Date.now() + workTimeMs,
|
|
22
|
-
timeRemaining
|
|
22
|
+
timeRemaining,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
function ProcessQueue(deadline = createDeadline()) {
|
|
@@ -49,7 +49,9 @@ function DoWork(ctx, deadline = createDeadline()) {
|
|
|
49
49
|
threadContext = ctx;
|
|
50
50
|
const async = ctx.async;
|
|
51
51
|
let callback;
|
|
52
|
-
while (async === ctx.async &&
|
|
52
|
+
while (async === ctx.async &&
|
|
53
|
+
deadline.timeRemaining() > 0 &&
|
|
54
|
+
(callback = list_1.List.Pop(ctx.workList)))
|
|
53
55
|
Invoke(ctx, callback);
|
|
54
56
|
if (ctx.workList.size > 0)
|
|
55
57
|
ScheduleWork(ctx);
|
|
@@ -59,7 +61,7 @@ function CreateContext() {
|
|
|
59
61
|
return {
|
|
60
62
|
async: false,
|
|
61
63
|
workEndNode: null,
|
|
62
|
-
workList: list_1.List.Create()
|
|
64
|
+
workList: list_1.List.Create(),
|
|
63
65
|
};
|
|
64
66
|
}
|
|
65
67
|
function ScheduleCallback(callback, before, async) {
|
|
@@ -89,7 +91,9 @@ function After(callback) {
|
|
|
89
91
|
}
|
|
90
92
|
function Callback(callback) {
|
|
91
93
|
return function (a, b, c, d) {
|
|
92
|
-
Schedule(function () {
|
|
94
|
+
Schedule(function () {
|
|
95
|
+
callback(a, b, c, d);
|
|
96
|
+
});
|
|
93
97
|
};
|
|
94
98
|
}
|
|
95
99
|
var inSynchCallback = false;
|
|
@@ -109,7 +113,7 @@ function Thread(callback) {
|
|
|
109
113
|
Synch(callback);
|
|
110
114
|
}
|
|
111
115
|
function ThreadAsync(callback) {
|
|
112
|
-
return new Promise(resolve => Thread(function (async) {
|
|
116
|
+
return new Promise((resolve) => Thread(function (async) {
|
|
113
117
|
callback(async);
|
|
114
118
|
Thread(resolve);
|
|
115
119
|
}));
|