mol_wire_lib 1.0.792 → 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.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
|
@@ -782,12 +782,26 @@ var $;
|
|
|
782
782
|
}
|
|
783
783
|
if (!$mol_promise_like(this.cache))
|
|
784
784
|
return this.cache;
|
|
785
|
-
await this.cache;
|
|
785
|
+
await Promise.race([this.cache, this.step()]);
|
|
786
|
+
if (!$mol_promise_like(this.cache))
|
|
787
|
+
return this.cache;
|
|
786
788
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
787
789
|
await new Promise(() => { });
|
|
788
790
|
}
|
|
789
791
|
}
|
|
790
792
|
}
|
|
793
|
+
step() {
|
|
794
|
+
return new Promise(done => {
|
|
795
|
+
const sub = new $mol_wire_pub_sub;
|
|
796
|
+
const prev = sub.track_on();
|
|
797
|
+
sub.track_next(this);
|
|
798
|
+
sub.track_off(prev);
|
|
799
|
+
sub.absorb = () => {
|
|
800
|
+
done(null);
|
|
801
|
+
sub.destructor();
|
|
802
|
+
};
|
|
803
|
+
});
|
|
804
|
+
}
|
|
791
805
|
}
|
|
792
806
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
793
807
|
})($ || ($ = {}));
|
package/web.test.js
CHANGED
|
@@ -1827,6 +1827,31 @@ var $;
|
|
|
1827
1827
|
var $;
|
|
1828
1828
|
(function ($_1) {
|
|
1829
1829
|
$mol_test({
|
|
1830
|
+
async 'Error caching'($) {
|
|
1831
|
+
const next_cached = 123;
|
|
1832
|
+
class Some extends $mol_object2 {
|
|
1833
|
+
static $ = $;
|
|
1834
|
+
static data(id, next) {
|
|
1835
|
+
if (next)
|
|
1836
|
+
return next;
|
|
1837
|
+
setTimeout(() => {
|
|
1838
|
+
$mol_wire_async(this).data(id, next_cached);
|
|
1839
|
+
}, 10);
|
|
1840
|
+
$mol_fail_hidden(new Promise(() => { }));
|
|
1841
|
+
}
|
|
1842
|
+
static run() {
|
|
1843
|
+
return this.data('1');
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
__decorate([
|
|
1847
|
+
$mol_wire_plex
|
|
1848
|
+
], Some, "data", null);
|
|
1849
|
+
__decorate([
|
|
1850
|
+
$mol_wire_method
|
|
1851
|
+
], Some, "run", null);
|
|
1852
|
+
const val = await $mol_wire_async(Some).run();
|
|
1853
|
+
$mol_assert_equal(val, next_cached);
|
|
1854
|
+
},
|
|
1830
1855
|
'Memoize by single simple key'($) {
|
|
1831
1856
|
class Team extends $mol_object2 {
|
|
1832
1857
|
static $ = $;
|