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