mol_wire_lib 1.0.791 → 1.0.793

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,7 +776,18 @@ var $;
776
776
  }
777
777
  if (!$mol_promise_like(this.cache))
778
778
  return this.cache;
779
- await 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
+ ]);
789
+ if (!$mol_promise_like(this.cache))
790
+ return this.cache;
780
791
  if (this.cursor === $mol_wire_cursor.final) {
781
792
  await new Promise(() => { });
782
793
  }
package/node.test.js CHANGED
@@ -768,7 +768,18 @@ var $;
768
768
  }
769
769
  if (!$mol_promise_like(this.cache))
770
770
  return this.cache;
771
- await 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
+ ]);
781
+ if (!$mol_promise_like(this.cache))
782
+ return this.cache;
772
783
  if (this.cursor === $mol_wire_cursor.final) {
773
784
  await new Promise(() => { });
774
785
  }
@@ -3342,7 +3353,7 @@ var $;
3342
3353
  if ('outerHTML' in val)
3343
3354
  return val.outerHTML;
3344
3355
  try {
3345
- return JSON.stringify(val);
3356
+ return JSON.stringify(val, null, '\t');
3346
3357
  }
3347
3358
  catch (error) {
3348
3359
  console.error(error);
@@ -3389,6 +3400,12 @@ var $;
3389
3400
  'three must be alike'() {
3390
3401
  $mol_assert_like([3], [3], [3]);
3391
3402
  },
3403
+ 'two object must be alike'() {
3404
+ $mol_assert_like({ a: 1 }, { a: 1 });
3405
+ },
3406
+ 'three object must be alike'() {
3407
+ $mol_assert_like({ a: 1 }, { a: 1 }, { a: 1 });
3408
+ },
3392
3409
  });
3393
3410
  })($ || ($ = {}));
3394
3411
  //mol/assert/assert.test.ts
@@ -4465,6 +4482,31 @@ var $;
4465
4482
  var $;
4466
4483
  (function ($_1) {
4467
4484
  $mol_test({
4485
+ async 'Error caching'($) {
4486
+ const next_cached = 123;
4487
+ class Some extends $mol_object2 {
4488
+ static $ = $;
4489
+ static data(id, next) {
4490
+ if (next)
4491
+ return next;
4492
+ setTimeout(() => {
4493
+ $mol_wire_async(this).data(id, next_cached);
4494
+ }, 10);
4495
+ $mol_fail_hidden(new Promise(() => { }));
4496
+ }
4497
+ static run() {
4498
+ return this.data('1');
4499
+ }
4500
+ }
4501
+ __decorate([
4502
+ $mol_wire_plex
4503
+ ], Some, "data", null);
4504
+ __decorate([
4505
+ $mol_wire_method
4506
+ ], Some, "run", null);
4507
+ const val = await $mol_wire_async(Some).run();
4508
+ $mol_assert_equal(val, next_cached);
4509
+ },
4468
4510
  'Memoize by single simple key'($) {
4469
4511
  class Team extends $mol_object2 {
4470
4512
  static $ = $;