mol_jsx_lib 0.0.660 → 0.0.662
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
|
@@ -1036,12 +1036,26 @@ var $;
|
|
|
1036
1036
|
}
|
|
1037
1037
|
if (!$mol_promise_like(this.cache))
|
|
1038
1038
|
return this.cache;
|
|
1039
|
-
await this.cache;
|
|
1039
|
+
await Promise.race([this.cache, this.step()]);
|
|
1040
|
+
if (!$mol_promise_like(this.cache))
|
|
1041
|
+
return this.cache;
|
|
1040
1042
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
1041
1043
|
await new Promise(() => { });
|
|
1042
1044
|
}
|
|
1043
1045
|
}
|
|
1044
1046
|
}
|
|
1047
|
+
step() {
|
|
1048
|
+
return new Promise(done => {
|
|
1049
|
+
const sub = new $mol_wire_pub_sub;
|
|
1050
|
+
const prev = sub.track_on();
|
|
1051
|
+
sub.track_next(this);
|
|
1052
|
+
sub.track_off(prev);
|
|
1053
|
+
sub.absorb = () => {
|
|
1054
|
+
done(null);
|
|
1055
|
+
sub.destructor();
|
|
1056
|
+
};
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1045
1059
|
}
|
|
1046
1060
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1047
1061
|
})($ || ($ = {}));
|
package/web.test.js
CHANGED
|
@@ -1676,6 +1676,31 @@ var $;
|
|
|
1676
1676
|
var $;
|
|
1677
1677
|
(function ($_1) {
|
|
1678
1678
|
$mol_test({
|
|
1679
|
+
async 'Error caching'($) {
|
|
1680
|
+
const next_cached = 123;
|
|
1681
|
+
class Some extends $mol_object2 {
|
|
1682
|
+
static $ = $;
|
|
1683
|
+
static data(id, next) {
|
|
1684
|
+
if (next)
|
|
1685
|
+
return next;
|
|
1686
|
+
setTimeout(() => {
|
|
1687
|
+
$mol_wire_async(this).data(id, next_cached);
|
|
1688
|
+
}, 10);
|
|
1689
|
+
$mol_fail_hidden(new Promise(() => { }));
|
|
1690
|
+
}
|
|
1691
|
+
static run() {
|
|
1692
|
+
return this.data('1');
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
__decorate([
|
|
1696
|
+
$mol_wire_plex
|
|
1697
|
+
], Some, "data", null);
|
|
1698
|
+
__decorate([
|
|
1699
|
+
$mol_wire_method
|
|
1700
|
+
], Some, "run", null);
|
|
1701
|
+
const val = await $mol_wire_async(Some).run();
|
|
1702
|
+
$mol_assert_equal(val, next_cached);
|
|
1703
|
+
},
|
|
1679
1704
|
'Memoize by single simple key'($) {
|
|
1680
1705
|
class Team extends $mol_object2 {
|
|
1681
1706
|
static $ = $;
|