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.test.js CHANGED
@@ -561,8 +561,8 @@ var $;
561
561
  task;
562
562
  host;
563
563
  static warm = true;
564
- static planning = [];
565
- static reaping = [];
564
+ static planning = new Set();
565
+ static reaping = new Set();
566
566
  static plan_task = null;
567
567
  static plan() {
568
568
  if (this.plan_task)
@@ -577,14 +577,16 @@ var $;
577
577
  });
578
578
  }
579
579
  static sync() {
580
- while (this.planning.length) {
581
- const fibers = this.planning.splice(0, this.planning.length);
580
+ while (this.planning.size) {
581
+ const fibers = this.planning;
582
+ this.planning = new Set;
582
583
  for (const fiber of fibers) {
583
584
  fiber.refresh();
584
585
  }
585
586
  }
586
- while (this.reaping.length) {
587
- const fibers = this.reaping.splice(0, this.reaping.length);
587
+ while (this.reaping.size) {
588
+ const fibers = this.reaping;
589
+ this.reaping = new Set;
588
590
  for (const fiber of fibers) {
589
591
  if (!fiber.sub_empty)
590
592
  continue;
@@ -615,11 +617,11 @@ var $;
615
617
  this[Symbol.toStringTag] = id;
616
618
  }
617
619
  plan() {
618
- $mol_wire_fiber.planning.push(this);
620
+ $mol_wire_fiber.planning.add(this);
619
621
  $mol_wire_fiber.plan();
620
622
  }
621
623
  reap() {
622
- $mol_wire_fiber.reaping.push(this);
624
+ $mol_wire_fiber.reaping.add(this);
623
625
  $mol_wire_fiber.plan();
624
626
  }
625
627
  toString() {
@@ -895,17 +897,18 @@ var $;
895
897
  }
896
898
  put(next) {
897
899
  const prev = this.cache;
898
- if (next !== prev) {
899
- this.cache = next;
900
- this.emit();
901
- }
900
+ this.cache = next;
902
901
  if (next instanceof Promise) {
903
902
  this.cursor = $mol_wire_cursor.fresh;
903
+ if (next !== prev)
904
+ this.emit();
904
905
  return next;
905
906
  }
906
907
  this.cursor = $mol_wire_cursor.final;
907
908
  if (this.sub_empty)
908
909
  this.destructor();
910
+ else if (next !== prev)
911
+ this.emit();
909
912
  return next;
910
913
  }
911
914
  }