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.deps.json +1 -1
- package/node.js +12 -1
- package/node.js.map +1 -1
- package/node.mjs +12 -1
- package/node.test.js +44 -2
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +12 -1
- package/web.js.map +1 -1
- package/web.mjs +12 -1
- package/web.test.js +32 -1
- package/web.test.js.map +1 -1
package/web.mjs
CHANGED
|
@@ -782,7 +782,18 @@ var $;
|
|
|
782
782
|
}
|
|
783
783
|
if (!$mol_promise_like(this.cache))
|
|
784
784
|
return this.cache;
|
|
785
|
-
await
|
|
785
|
+
await Promise.race([
|
|
786
|
+
this.cache,
|
|
787
|
+
new Promise(done => {
|
|
788
|
+
const sub = new $mol_wire_pub_sub;
|
|
789
|
+
const prev = sub.track_on();
|
|
790
|
+
sub.track_next(this);
|
|
791
|
+
sub.track_off(prev);
|
|
792
|
+
sub.absorb = done;
|
|
793
|
+
})
|
|
794
|
+
]);
|
|
795
|
+
if (!$mol_promise_like(this.cache))
|
|
796
|
+
return this.cache;
|
|
786
797
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
787
798
|
await new Promise(() => { });
|
|
788
799
|
}
|
package/web.test.js
CHANGED
|
@@ -862,7 +862,7 @@ var $;
|
|
|
862
862
|
if ('outerHTML' in val)
|
|
863
863
|
return val.outerHTML;
|
|
864
864
|
try {
|
|
865
|
-
return JSON.stringify(val);
|
|
865
|
+
return JSON.stringify(val, null, '\t');
|
|
866
866
|
}
|
|
867
867
|
catch (error) {
|
|
868
868
|
console.error(error);
|
|
@@ -909,6 +909,12 @@ var $;
|
|
|
909
909
|
'three must be alike'() {
|
|
910
910
|
$mol_assert_like([3], [3], [3]);
|
|
911
911
|
},
|
|
912
|
+
'two object must be alike'() {
|
|
913
|
+
$mol_assert_like({ a: 1 }, { a: 1 });
|
|
914
|
+
},
|
|
915
|
+
'three object must be alike'() {
|
|
916
|
+
$mol_assert_like({ a: 1 }, { a: 1 }, { a: 1 });
|
|
917
|
+
},
|
|
912
918
|
});
|
|
913
919
|
})($ || ($ = {}));
|
|
914
920
|
//mol/assert/assert.test.ts
|
|
@@ -1821,6 +1827,31 @@ var $;
|
|
|
1821
1827
|
var $;
|
|
1822
1828
|
(function ($_1) {
|
|
1823
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
|
+
},
|
|
1824
1855
|
'Memoize by single simple key'($) {
|
|
1825
1856
|
class Team extends $mol_object2 {
|
|
1826
1857
|
static $ = $;
|