@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/README.md +7 -7
- package/dist/atom-effect.min.js +1 -1
- package/dist/atom-effect.min.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -34
- package/dist/index.mjs +399 -366
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
-
*
|
|
415
|
+
* Simplified scheduler for reactive updates with double-buffered queue.
|
|
423
416
|
*/
|
|
424
417
|
declare class Scheduler {
|
|
425
|
-
private
|
|
426
|
-
private
|
|
427
|
-
private
|
|
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
|
|
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
|
|
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
|
-
|
|
439
|
+
schedule(callback: SchedulerJob): void;
|
|
461
440
|
/**
|
|
462
|
-
* Schedules a microtask-based flush of the
|
|
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
|
|
473
|
-
* Increments the epoch
|
|
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
|
|
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
|
/**
|