reactronic 0.21.526 → 0.21.527
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.
|
@@ -24,7 +24,7 @@ export declare abstract class Transaction implements Worker {
|
|
|
24
24
|
static run<T>(func: F<T>, ...args: any[]): T;
|
|
25
25
|
static runAs<T>(options: SnapshotOptions | null, func: F<T>, ...args: any[]): T;
|
|
26
26
|
static standalone<T>(func: F<T>, ...args: any[]): T;
|
|
27
|
-
static isFrameOver(everyN?: number): boolean;
|
|
28
|
-
static requestNextFrame(): Promise<void>;
|
|
27
|
+
static isFrameOver(everyN?: number, timeLimit?: number): boolean;
|
|
28
|
+
static requestNextFrame(sleepTime?: number): Promise<void>;
|
|
29
29
|
static get isCanceled(): boolean;
|
|
30
30
|
}
|
|
@@ -22,8 +22,8 @@ class Transaction {
|
|
|
22
22
|
static run(func, ...args) { return TransactionImpl.run(func, ...args); }
|
|
23
23
|
static runAs(options, func, ...args) { return TransactionImpl.runAs(options, func, ...args); }
|
|
24
24
|
static standalone(func, ...args) { return TransactionImpl.standalone(func, ...args); }
|
|
25
|
-
static isFrameOver(everyN = 1) { return TransactionImpl.isFrameOver(everyN); }
|
|
26
|
-
static requestNextFrame() { return TransactionImpl.requestNextFrame(); }
|
|
25
|
+
static isFrameOver(everyN = 1, timeLimit = 14) { return TransactionImpl.isFrameOver(everyN, timeLimit); }
|
|
26
|
+
static requestNextFrame(sleepTime = 0) { return TransactionImpl.requestNextFrame(sleepTime); }
|
|
27
27
|
static get isCanceled() { return TransactionImpl.current.isCanceled; }
|
|
28
28
|
}
|
|
29
29
|
exports.Transaction = Transaction;
|
|
@@ -143,12 +143,12 @@ class TransactionImpl extends Transaction {
|
|
|
143
143
|
TransactionImpl.curr = outer;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
static isFrameOver(everyN = 1) {
|
|
147
|
-
TransactionImpl.
|
|
148
|
-
let result = TransactionImpl.
|
|
146
|
+
static isFrameOver(everyN = 1, timeLimit = 14) {
|
|
147
|
+
TransactionImpl.frameOverCounter++;
|
|
148
|
+
let result = TransactionImpl.frameOverCounter % everyN === 0;
|
|
149
149
|
if (result) {
|
|
150
|
-
const ms = performance.now() - TransactionImpl.
|
|
151
|
-
result = ms >
|
|
150
|
+
const ms = performance.now() - TransactionImpl.frameStartTime;
|
|
151
|
+
result = ms > timeLimit;
|
|
152
152
|
}
|
|
153
153
|
return result;
|
|
154
154
|
}
|
|
@@ -206,8 +206,8 @@ class TransactionImpl extends Transaction {
|
|
|
206
206
|
const outer = TransactionImpl.curr;
|
|
207
207
|
try {
|
|
208
208
|
if (outer === TransactionImpl.none) {
|
|
209
|
-
TransactionImpl.
|
|
210
|
-
TransactionImpl.
|
|
209
|
+
TransactionImpl.frameStartTime = performance.now();
|
|
210
|
+
TransactionImpl.frameOverCounter = 0;
|
|
211
211
|
}
|
|
212
212
|
TransactionImpl.curr = this;
|
|
213
213
|
this.pending++;
|
|
@@ -309,7 +309,6 @@ class TransactionImpl extends Transaction {
|
|
|
309
309
|
TransactionImpl.none = new TransactionImpl({ hint: '<none>' });
|
|
310
310
|
TransactionImpl.curr = TransactionImpl.none;
|
|
311
311
|
TransactionImpl.inspection = false;
|
|
312
|
-
TransactionImpl.
|
|
313
|
-
TransactionImpl.
|
|
314
|
-
TransactionImpl.checkCount = 0;
|
|
312
|
+
TransactionImpl.frameStartTime = 0;
|
|
313
|
+
TransactionImpl.frameOverCounter = 0;
|
|
315
314
|
TransactionImpl._init();
|