hyoo_sync_client 0.0.228 → 0.0.230
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.d.ts +1 -0
- package/node.deps.json +1 -1
- package/node.js +15 -1
- package/node.js.map +1 -1
- package/node.mjs +15 -1
- package/node.test.js +40 -1
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +1 -0
- package/web.deps.json +1 -1
- package/web.js +15 -1
- package/web.js.map +1 -1
- package/web.mjs +15 -1
- package/web.test.js +25 -0
- package/web.test.js.map +1 -1
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
|
@@ -1832,6 +1832,31 @@ var $;
|
|
|
1832
1832
|
var $;
|
|
1833
1833
|
(function ($_1) {
|
|
1834
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
|
+
},
|
|
1835
1860
|
'Memoize by single simple key'($) {
|
|
1836
1861
|
class Team extends $mol_object2 {
|
|
1837
1862
|
static $ = $;
|