@but212/atom-effect 0.14.0 → 0.15.0

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.d.ts CHANGED
@@ -361,13 +361,6 @@ export declare function isComputed(obj: unknown): obj is ComputedAtom;
361
361
  /** Checks if the given object is an EffectObject. */
362
362
  export declare function isEffect(obj: unknown): obj is EffectObject;
363
363
 
364
- /**
365
- * Interface for nodes that support phase-shift priority calculation.
366
- */
367
- declare interface PhaseShiftNode {
368
- getShift(cachedVersion: number): number;
369
- }
370
-
371
364
  /**
372
365
  * Object pool configuration
373
366
  * Controls memory management and GC pressure reduction
@@ -419,13 +412,12 @@ export declare interface ReadonlyAtom<T = unknown> {
419
412
  }
420
413
 
421
414
  /**
422
- * Scheduler for reactive updates with double-buffered priority queues.
415
+ * Simplified scheduler for reactive updates with double-buffered queue.
423
416
  */
424
417
  declare class Scheduler {
425
- private _queueBuffers;
426
- private _bufferIndices;
427
- private _sizes;
428
- private _activeQueues;
418
+ private _queueBuffer;
419
+ private _bufferIndex;
420
+ private _size;
429
421
  private _epoch;
430
422
  private isProcessing;
431
423
  isBatching: boolean;
@@ -439,27 +431,14 @@ declare class Scheduler {
439
431
  * Returns the current operational phase of the scheduler.
440
432
  */
441
433
  get phase(): SchedulerPhase;
442
- /** Current number of pending normal jobs. */
434
+ /** Current number of pending jobs. */
443
435
  get queueSize(): number;
444
- /** Current number of pending urgent jobs. */
445
- get urgentQueueSize(): number;
446
436
  /**
447
- * Schedules a task for execution with optional priority based on phase shift.
448
- */
449
- schedule(callback: SchedulerJob, sourceNode?: PhaseShiftNode): void;
450
- /**
451
- * Calculates urgency flag using branchless bit manipulation.
452
- *
453
- * Logic:
454
- * 1. Calculate the 'shift' (rotation distance) from the cached version.
455
- * 2. Compare against PHASE_THRESHOLD (180° rotation equivalent).
456
- * 3. Use (N >>> 31) to extract the sign bit in O(1) time.
457
- *
458
- * @returns 1 if urgent (shift >= PHASE_THRESHOLD), 0 otherwise.
437
+ * Schedules a task for execution.
459
438
  */
460
- private _calculateUrgency;
439
+ schedule(callback: SchedulerJob): void;
461
440
  /**
462
- * Schedules a microtask-based flush of the queues.
441
+ * Schedules a microtask-based flush of the queue.
463
442
  * Coalesces multiple schedule calls into a single microtask execution.
464
443
  */
465
444
  private flush;
@@ -469,8 +448,8 @@ declare class Scheduler {
469
448
  */
470
449
  private flushSync;
471
450
  /**
472
- * Merges jobs from the batching queue into the primary normal queue.
473
- * Increments the epoch/uses provided epoch to ensure deduplication.
451
+ * Merges jobs from the batching queue into the primary queue.
452
+ * Increments the epoch to ensure deduplication.
474
453
  */
475
454
  private _mergeBatchQueue;
476
455
  private _drainQueue;
@@ -527,14 +506,12 @@ export declare class SchedulerError extends AtomError {
527
506
  }
528
507
 
529
508
  /**
530
- * Scheduler job interface with phase-shift tracking support.
509
+ * Scheduler job interface.
531
510
  */
532
511
  declare interface SchedulerJob {
533
512
  (): void;
534
513
  /** Epoch for deduplication */
535
514
  _nextEpoch?: number;
536
- /** Cached version for phase-shift priority calculation */
537
- _cachedVersion?: number;
538
515
  }
539
516
 
540
517
  /**