mol_wire_lib 1.0.124 → 1.0.127

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/node.js CHANGED
@@ -569,8 +569,8 @@ var $;
569
569
  task;
570
570
  host;
571
571
  static warm = true;
572
- static planning = [];
573
- static reaping = [];
572
+ static planning = new Set();
573
+ static reaping = new Set();
574
574
  static plan_task = null;
575
575
  static plan() {
576
576
  if (this.plan_task)
@@ -585,14 +585,16 @@ var $;
585
585
  });
586
586
  }
587
587
  static sync() {
588
- while (this.planning.length) {
589
- const fibers = this.planning.splice(0, this.planning.length);
588
+ while (this.planning.size) {
589
+ const fibers = this.planning;
590
+ this.planning = new Set;
590
591
  for (const fiber of fibers) {
591
592
  fiber.refresh();
592
593
  }
593
594
  }
594
- while (this.reaping.length) {
595
- const fibers = this.reaping.splice(0, this.reaping.length);
595
+ while (this.reaping.size) {
596
+ const fibers = this.reaping;
597
+ this.reaping = new Set;
596
598
  for (const fiber of fibers) {
597
599
  if (!fiber.sub_empty)
598
600
  continue;
@@ -623,11 +625,11 @@ var $;
623
625
  this[Symbol.toStringTag] = id;
624
626
  }
625
627
  plan() {
626
- $mol_wire_fiber.planning.push(this);
628
+ $mol_wire_fiber.planning.add(this);
627
629
  $mol_wire_fiber.plan();
628
630
  }
629
631
  reap() {
630
- $mol_wire_fiber.reaping.push(this);
632
+ $mol_wire_fiber.reaping.add(this);
631
633
  $mol_wire_fiber.plan();
632
634
  }
633
635
  toString() {
@@ -903,17 +905,18 @@ var $;
903
905
  }
904
906
  put(next) {
905
907
  const prev = this.cache;
906
- if (next !== prev) {
907
- this.cache = next;
908
- this.emit();
909
- }
908
+ this.cache = next;
910
909
  if (next instanceof Promise) {
911
910
  this.cursor = $mol_wire_cursor.fresh;
911
+ if (next !== prev)
912
+ this.emit();
912
913
  return next;
913
914
  }
914
915
  this.cursor = $mol_wire_cursor.final;
915
916
  if (this.sub_empty)
916
917
  this.destructor();
918
+ else if (next !== prev)
919
+ this.emit();
917
920
  return next;
918
921
  }
919
922
  }