mol_wire_lib 1.0.793 → 1.0.794

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.mjs CHANGED
@@ -776,16 +776,7 @@ var $;
776
776
  }
777
777
  if (!$mol_promise_like(this.cache))
778
778
  return this.cache;
779
- await Promise.race([
780
- this.cache,
781
- new Promise(done => {
782
- const sub = new $mol_wire_pub_sub;
783
- const prev = sub.track_on();
784
- sub.track_next(this);
785
- sub.track_off(prev);
786
- sub.absorb = done;
787
- })
788
- ]);
779
+ await Promise.race([this.cache, this.step()]);
789
780
  if (!$mol_promise_like(this.cache))
790
781
  return this.cache;
791
782
  if (this.cursor === $mol_wire_cursor.final) {
@@ -793,6 +784,18 @@ var $;
793
784
  }
794
785
  }
795
786
  }
787
+ step() {
788
+ return new Promise(done => {
789
+ const sub = new $mol_wire_pub_sub;
790
+ const prev = sub.track_on();
791
+ sub.track_next(this);
792
+ sub.track_off(prev);
793
+ sub.absorb = () => {
794
+ done(null);
795
+ sub.destructor();
796
+ };
797
+ });
798
+ }
796
799
  }
797
800
  $.$mol_wire_fiber = $mol_wire_fiber;
798
801
  })($ || ($ = {}));
package/node.test.js CHANGED
@@ -768,16 +768,7 @@ var $;
768
768
  }
769
769
  if (!$mol_promise_like(this.cache))
770
770
  return this.cache;
771
- await Promise.race([
772
- this.cache,
773
- new Promise(done => {
774
- const sub = new $mol_wire_pub_sub;
775
- const prev = sub.track_on();
776
- sub.track_next(this);
777
- sub.track_off(prev);
778
- sub.absorb = done;
779
- })
780
- ]);
771
+ await Promise.race([this.cache, this.step()]);
781
772
  if (!$mol_promise_like(this.cache))
782
773
  return this.cache;
783
774
  if (this.cursor === $mol_wire_cursor.final) {
@@ -785,6 +776,18 @@ var $;
785
776
  }
786
777
  }
787
778
  }
779
+ step() {
780
+ return new Promise(done => {
781
+ const sub = new $mol_wire_pub_sub;
782
+ const prev = sub.track_on();
783
+ sub.track_next(this);
784
+ sub.track_off(prev);
785
+ sub.absorb = () => {
786
+ done(null);
787
+ sub.destructor();
788
+ };
789
+ });
790
+ }
788
791
  }
789
792
  $.$mol_wire_fiber = $mol_wire_fiber;
790
793
  })($ || ($ = {}));