@pretable/core 0.14.1 → 0.14.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.
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -9343,13 +9343,16 @@ function createCooperativeTransitionRuntime(options) {
|
|
|
9343
9343
|
if (!Number.isFinite(budgetMs) || budgetMs <= 0) throw new RangeError("The cooperative transition budget must be positive.");
|
|
9344
9344
|
if (!Number.isSafeInteger(maxUnitsPerSlice) || maxUnitsPerSlice <= 0) throw new RangeError("The cooperative transition unit cap must be a positive safe integer.");
|
|
9345
9345
|
const scheduler = (_options$scheduler = options.scheduler) !== null && _options$scheduler !== void 0 ? _options$scheduler : createDefaultCooperativeTransitionScheduler();
|
|
9346
|
+
const now = (_options$now = options.now) !== null && _options$now !== void 0 ? _options$now : (() => typeof performance === "object" && performance !== null && typeof performance.now === "function" ? performance.now() : Date.now());
|
|
9346
9347
|
const instrumentedScheduler = options.instrumentation === void 0 ? void 0 : { schedule(task) {
|
|
9347
9348
|
const token = {};
|
|
9348
9349
|
options.instrumentation.scheduledCallbacks.add(token);
|
|
9350
|
+
const scheduledAt = now();
|
|
9349
9351
|
let cancel;
|
|
9350
9352
|
try {
|
|
9351
9353
|
cancel = scheduler.schedule(() => {
|
|
9352
9354
|
options.instrumentation.scheduledCallbacks.delete(token);
|
|
9355
|
+
options.instrumentation.work.schedulerWaitDurations.push(Math.max(0, now() - scheduledAt));
|
|
9353
9356
|
task();
|
|
9354
9357
|
});
|
|
9355
9358
|
} catch (error) {
|
|
@@ -9363,7 +9366,7 @@ function createCooperativeTransitionRuntime(options) {
|
|
|
9363
9366
|
} };
|
|
9364
9367
|
return Object.freeze({
|
|
9365
9368
|
scheduler: instrumentedScheduler !== null && instrumentedScheduler !== void 0 ? instrumentedScheduler : scheduler,
|
|
9366
|
-
now
|
|
9369
|
+
now,
|
|
9367
9370
|
budgetMs,
|
|
9368
9371
|
maxUnitsPerSlice,
|
|
9369
9372
|
instrumentation: options.instrumentation
|