@but212/atom-effect 0.15.1 → 0.15.2

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.mjs CHANGED
@@ -458,18 +458,24 @@ function fe() {
458
458
  }
459
459
  class Ee {
460
460
  constructor() {
461
- this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this.isProcessing = !1, this.isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = T.MAX_FLUSH_ITERATIONS;
461
+ this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this.isProcessing = !1, this._isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = T.MAX_FLUSH_ITERATIONS;
462
462
  }
463
463
  /**
464
464
  * Returns the current operational phase of the scheduler.
465
465
  */
466
466
  get phase() {
467
- return this.isProcessing || this.isFlushingSync ? 2 : this.isBatching ? 1 : 0;
467
+ return this.isProcessing || this.isFlushingSync ? 2 : this._isBatching ? 1 : 0;
468
468
  }
469
469
  /** Current number of pending jobs. */
470
470
  get queueSize() {
471
471
  return this._size;
472
472
  }
473
+ /**
474
+ * Returns whether the scheduler is currently batching updates.
475
+ */
476
+ get isBatching() {
477
+ return this._isBatching;
478
+ }
473
479
  /**
474
480
  * Schedules a task for execution.
475
481
  */
@@ -478,7 +484,7 @@ class Ee {
478
484
  throw new P("Scheduler callback must be a function");
479
485
  const t = this._epoch;
480
486
  if (e._nextEpoch !== t) {
481
- if (e._nextEpoch = t, this.isBatching || this.isFlushingSync) {
487
+ if (e._nextEpoch = t, this._isBatching || this.isFlushingSync) {
482
488
  this.batchQueue[this.batchQueueSize++] = e;
483
489
  return;
484
490
  }
@@ -496,7 +502,7 @@ class Ee {
496
502
  const e = J();
497
503
  this._drainQueue(), e && $();
498
504
  } finally {
499
- this.isProcessing = !1, this._size > 0 && !this.isBatching && this.flush();
505
+ this.isProcessing = !1, this._size > 0 && !this._isBatching && this.flush();
500
506
  }
501
507
  }));
502
508
  }
@@ -562,14 +568,14 @@ class Ee {
562
568
  e.length = 0;
563
569
  }
564
570
  startBatch() {
565
- this.batchDepth++, this.isBatching = !0;
571
+ this.batchDepth++, this._isBatching = !0;
566
572
  }
567
573
  endBatch() {
568
574
  if (this.batchDepth === 0) {
569
575
  E && console.warn("endBatch() called without matching startBatch(). Ignoring.");
570
576
  return;
571
577
  }
572
- this.batchDepth--, this.batchDepth === 0 && (this.flushSync(), this.isBatching = !1);
578
+ this.batchDepth--, this.batchDepth === 0 && (this.flushSync(), this._isBatching = !1);
573
579
  }
574
580
  setMaxFlushIterations(e) {
575
581
  if (e < T.MIN_FLUSH_ITERATIONS)
@@ -705,10 +711,10 @@ function Re(i) {
705
711
  function te(i) {
706
712
  return i != null && typeof i.then == "function";
707
713
  }
708
- const se = u.RESOLVED | u.PENDING | u.REJECTED, V = Array(se + 1).fill(M.IDLE);
709
- V[u.RESOLVED] = M.RESOLVED;
710
- V[u.PENDING] = M.PENDING;
711
- V[u.REJECTED] = M.REJECTED;
714
+ const se = u.RESOLVED | u.PENDING | u.REJECTED, B = Array(se + 1).fill(M.IDLE);
715
+ B[u.RESOLVED] = M.RESOLVED;
716
+ B[u.PENDING] = M.PENDING;
717
+ B[u.REJECTED] = M.REJECTED;
712
718
  class be {
713
719
  constructor(e) {
714
720
  this._owner = e, this._epoch = -1, this._nextDeps = d, this._nextVersions = p, this._depCount = 0;
@@ -758,7 +764,7 @@ class ie extends Z {
758
764
  }
759
765
  get state() {
760
766
  const e = f.current;
761
- return e && N(this, e, this._fnSubs, this._objSubs), V[this.flags & se];
767
+ return e && N(this, e, this._fnSubs, this._objSubs), B[this.flags & se];
762
768
  }
763
769
  get hasError() {
764
770
  const e = f.current;
@@ -786,7 +792,7 @@ class ie extends Z {
786
792
  const h = n[o];
787
793
  if (h && "errors" in h) {
788
794
  const _ = h.errors;
789
- for (let a = 0, B = _.length; a < B; a++) {
795
+ for (let a = 0, V = _.length; a < V; a++) {
790
796
  const X = _[a];
791
797
  X && s.add(X);
792
798
  }
@@ -1010,8 +1016,8 @@ class Ie extends W {
1010
1016
  if (typeof h == "function")
1011
1017
  try {
1012
1018
  h();
1013
- } catch (B) {
1014
- this._handleExecutionError(B, l.EFFECT_CLEANUP_FAILED);
1019
+ } catch (V) {
1020
+ this._handleExecutionError(V, l.EFFECT_CLEANUP_FAILED);
1015
1021
  }
1016
1022
  return;
1017
1023
  }