hyoo_sync_client 0.0.227 → 0.0.229

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/web.mjs CHANGED
@@ -1334,12 +1334,26 @@ var $;
1334
1334
  }
1335
1335
  if (!$mol_promise_like(this.cache))
1336
1336
  return this.cache;
1337
- await this.cache;
1337
+ await Promise.race([this.cache, this.step()]);
1338
+ if (!$mol_promise_like(this.cache))
1339
+ return this.cache;
1338
1340
  if (this.cursor === $mol_wire_cursor.final) {
1339
1341
  await new Promise(() => { });
1340
1342
  }
1341
1343
  }
1342
1344
  }
1345
+ step() {
1346
+ return new Promise(done => {
1347
+ const sub = new $mol_wire_pub_sub;
1348
+ const prev = sub.track_on();
1349
+ sub.track_next(this);
1350
+ sub.track_off(prev);
1351
+ sub.absorb = () => {
1352
+ done(null);
1353
+ sub.destructor();
1354
+ };
1355
+ });
1356
+ }
1343
1357
  }
1344
1358
  $.$mol_wire_fiber = $mol_wire_fiber;
1345
1359
  })($ || ($ = {}));
package/web.test.js CHANGED
@@ -670,7 +670,7 @@ var $;
670
670
  if ('outerHTML' in val)
671
671
  return val.outerHTML;
672
672
  try {
673
- return JSON.stringify(val);
673
+ return JSON.stringify(val, null, '\t');
674
674
  }
675
675
  catch (error) {
676
676
  console.error(error);
@@ -717,6 +717,12 @@ var $;
717
717
  'three must be alike'() {
718
718
  $mol_assert_like([3], [3], [3]);
719
719
  },
720
+ 'two object must be alike'() {
721
+ $mol_assert_like({ a: 1 }, { a: 1 });
722
+ },
723
+ 'three object must be alike'() {
724
+ $mol_assert_like({ a: 1 }, { a: 1 }, { a: 1 });
725
+ },
720
726
  });
721
727
  })($ || ($ = {}));
722
728
  //mol/assert/assert.test.ts
@@ -1826,6 +1832,31 @@ var $;
1826
1832
  var $;
1827
1833
  (function ($_1) {
1828
1834
  $mol_test({
1835
+ async 'Error caching'($) {
1836
+ const next_cached = 123;
1837
+ class Some extends $mol_object2 {
1838
+ static $ = $;
1839
+ static data(id, next) {
1840
+ if (next)
1841
+ return next;
1842
+ setTimeout(() => {
1843
+ $mol_wire_async(this).data(id, next_cached);
1844
+ }, 10);
1845
+ $mol_fail_hidden(new Promise(() => { }));
1846
+ }
1847
+ static run() {
1848
+ return this.data('1');
1849
+ }
1850
+ }
1851
+ __decorate([
1852
+ $mol_wire_plex
1853
+ ], Some, "data", null);
1854
+ __decorate([
1855
+ $mol_wire_method
1856
+ ], Some, "run", null);
1857
+ const val = await $mol_wire_async(Some).run();
1858
+ $mol_assert_equal(val, next_cached);
1859
+ },
1829
1860
  'Memoize by single simple key'($) {
1830
1861
  class Team extends $mol_object2 {
1831
1862
  static $ = $;