mol_wire_lib 1.0.28 → 1.0.32
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/README.md +1 -1
- package/node.d.ts +20 -2
- package/node.deps.json +1 -1
- package/node.esm.js +46 -5
- package/node.esm.js.map +1 -1
- package/node.js +46 -5
- package/node.js.map +1 -1
- package/node.test.js +218 -143
- package/node.test.js.map +1 -1
- package/package.json +5 -2
- package/web.d.ts +30 -2
- package/web.deps.json +1 -1
- package/web.esm.js +67 -5
- package/web.esm.js.map +1 -1
- package/web.js +67 -5
- package/web.js.map +1 -1
- package/web.test.js +172 -159
- package/web.test.js.map +1 -1
package/web.test.js
CHANGED
|
@@ -565,64 +565,6 @@ var $;
|
|
|
565
565
|
;
|
|
566
566
|
"use strict";
|
|
567
567
|
var $;
|
|
568
|
-
(function ($_1) {
|
|
569
|
-
$mol_test({
|
|
570
|
-
'Collect deps'() {
|
|
571
|
-
const pub1 = new $mol_wire_pub;
|
|
572
|
-
const pub2 = new $mol_wire_pub;
|
|
573
|
-
const sub = new $mol_wire_pub_sub;
|
|
574
|
-
const bu1 = sub.track_on();
|
|
575
|
-
try {
|
|
576
|
-
pub1.track_promote();
|
|
577
|
-
pub2.track_promote();
|
|
578
|
-
pub2.track_promote();
|
|
579
|
-
}
|
|
580
|
-
finally {
|
|
581
|
-
sub.track_cut();
|
|
582
|
-
sub.track_off(bu1);
|
|
583
|
-
}
|
|
584
|
-
pub1.emit();
|
|
585
|
-
pub2.emit();
|
|
586
|
-
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
587
|
-
const bu2 = sub.track_on();
|
|
588
|
-
try {
|
|
589
|
-
pub1.track_promote();
|
|
590
|
-
pub1.track_promote();
|
|
591
|
-
pub2.track_promote();
|
|
592
|
-
}
|
|
593
|
-
finally {
|
|
594
|
-
sub.track_cut();
|
|
595
|
-
sub.track_off(bu2);
|
|
596
|
-
}
|
|
597
|
-
pub1.emit();
|
|
598
|
-
pub2.emit();
|
|
599
|
-
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
600
|
-
},
|
|
601
|
-
'cyclic detection'($) {
|
|
602
|
-
const sub1 = new $mol_wire_pub_sub;
|
|
603
|
-
const sub2 = new $mol_wire_pub_sub;
|
|
604
|
-
const bu1 = sub1.track_on();
|
|
605
|
-
try {
|
|
606
|
-
const bu2 = sub2.track_on();
|
|
607
|
-
try {
|
|
608
|
-
$mol_assert_fail(() => sub1.track_promote(), 'Circular subscription');
|
|
609
|
-
}
|
|
610
|
-
finally {
|
|
611
|
-
sub2.track_cut();
|
|
612
|
-
sub2.track_off(bu2);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
finally {
|
|
616
|
-
sub1.track_cut();
|
|
617
|
-
sub1.track_off(bu1);
|
|
618
|
-
}
|
|
619
|
-
},
|
|
620
|
-
});
|
|
621
|
-
})($ || ($ = {}));
|
|
622
|
-
//mol/wire/pub/sub/sub.test.ts
|
|
623
|
-
;
|
|
624
|
-
"use strict";
|
|
625
|
-
var $;
|
|
626
568
|
(function ($) {
|
|
627
569
|
$mol_test({
|
|
628
570
|
'get'() {
|
|
@@ -689,25 +631,6 @@ var $;
|
|
|
689
631
|
;
|
|
690
632
|
"use strict";
|
|
691
633
|
var $;
|
|
692
|
-
(function ($) {
|
|
693
|
-
function $mol_promise() {
|
|
694
|
-
let done;
|
|
695
|
-
let fail;
|
|
696
|
-
const promise = new Promise((d, f) => {
|
|
697
|
-
done = d;
|
|
698
|
-
fail = f;
|
|
699
|
-
});
|
|
700
|
-
return Object.assign(promise, {
|
|
701
|
-
done,
|
|
702
|
-
fail,
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
$.$mol_promise = $mol_promise;
|
|
706
|
-
})($ || ($ = {}));
|
|
707
|
-
//mol/promise/promise.ts
|
|
708
|
-
;
|
|
709
|
-
"use strict";
|
|
710
|
-
var $;
|
|
711
634
|
(function ($) {
|
|
712
635
|
$.$mol_after_mock_queue = [];
|
|
713
636
|
function $mol_after_mock_warp() {
|
|
@@ -755,45 +678,6 @@ var $;
|
|
|
755
678
|
;
|
|
756
679
|
"use strict";
|
|
757
680
|
var $;
|
|
758
|
-
(function ($) {
|
|
759
|
-
class $mol_after_timeout extends $mol_object2 {
|
|
760
|
-
delay;
|
|
761
|
-
task;
|
|
762
|
-
id;
|
|
763
|
-
constructor(delay, task) {
|
|
764
|
-
super();
|
|
765
|
-
this.delay = delay;
|
|
766
|
-
this.task = task;
|
|
767
|
-
this.id = setTimeout(task, delay);
|
|
768
|
-
}
|
|
769
|
-
destructor() {
|
|
770
|
-
clearTimeout(this.id);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
$.$mol_after_timeout = $mol_after_timeout;
|
|
774
|
-
})($ || ($ = {}));
|
|
775
|
-
//mol/after/timeout/timeout.ts
|
|
776
|
-
;
|
|
777
|
-
"use strict";
|
|
778
|
-
var $;
|
|
779
|
-
(function ($) {
|
|
780
|
-
function $mol_wait_timeout_async(timeout) {
|
|
781
|
-
const promise = $mol_promise();
|
|
782
|
-
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
783
|
-
return Object.assign(promise, {
|
|
784
|
-
destructor: () => task.destructor()
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
788
|
-
function $mol_wait_timeout(timeout) {
|
|
789
|
-
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
790
|
-
}
|
|
791
|
-
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
792
|
-
})($ || ($ = {}));
|
|
793
|
-
//mol/wait/timeout/timeout.ts
|
|
794
|
-
;
|
|
795
|
-
"use strict";
|
|
796
|
-
var $;
|
|
797
681
|
(function ($_1) {
|
|
798
682
|
$mol_test({
|
|
799
683
|
async 'Latest Calls Wins on Concurrency'($) {
|
|
@@ -821,6 +705,64 @@ var $;
|
|
|
821
705
|
;
|
|
822
706
|
"use strict";
|
|
823
707
|
var $;
|
|
708
|
+
(function ($_1) {
|
|
709
|
+
$mol_test({
|
|
710
|
+
'Collect deps'() {
|
|
711
|
+
const pub1 = new $mol_wire_pub;
|
|
712
|
+
const pub2 = new $mol_wire_pub;
|
|
713
|
+
const sub = new $mol_wire_pub_sub;
|
|
714
|
+
const bu1 = sub.track_on();
|
|
715
|
+
try {
|
|
716
|
+
pub1.promote();
|
|
717
|
+
pub2.promote();
|
|
718
|
+
pub2.promote();
|
|
719
|
+
}
|
|
720
|
+
finally {
|
|
721
|
+
sub.track_cut();
|
|
722
|
+
sub.track_off(bu1);
|
|
723
|
+
}
|
|
724
|
+
pub1.emit();
|
|
725
|
+
pub2.emit();
|
|
726
|
+
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
727
|
+
const bu2 = sub.track_on();
|
|
728
|
+
try {
|
|
729
|
+
pub1.promote();
|
|
730
|
+
pub1.promote();
|
|
731
|
+
pub2.promote();
|
|
732
|
+
}
|
|
733
|
+
finally {
|
|
734
|
+
sub.track_cut();
|
|
735
|
+
sub.track_off(bu2);
|
|
736
|
+
}
|
|
737
|
+
pub1.emit();
|
|
738
|
+
pub2.emit();
|
|
739
|
+
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
740
|
+
},
|
|
741
|
+
'cyclic detection'($) {
|
|
742
|
+
const sub1 = new $mol_wire_pub_sub;
|
|
743
|
+
const sub2 = new $mol_wire_pub_sub;
|
|
744
|
+
const bu1 = sub1.track_on();
|
|
745
|
+
try {
|
|
746
|
+
const bu2 = sub2.track_on();
|
|
747
|
+
try {
|
|
748
|
+
$mol_assert_fail(() => sub1.promote(), 'Circular subscription');
|
|
749
|
+
}
|
|
750
|
+
finally {
|
|
751
|
+
sub2.track_cut();
|
|
752
|
+
sub2.track_off(bu2);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
finally {
|
|
756
|
+
sub1.track_cut();
|
|
757
|
+
sub1.track_off(bu1);
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
});
|
|
761
|
+
})($ || ($ = {}));
|
|
762
|
+
//mol/wire/pub/sub/sub.test.ts
|
|
763
|
+
;
|
|
764
|
+
"use strict";
|
|
765
|
+
var $;
|
|
824
766
|
(function ($) {
|
|
825
767
|
$mol_test({
|
|
826
768
|
'Primitives'() {
|
|
@@ -1568,50 +1510,12 @@ var $;
|
|
|
1568
1510
|
"use strict";
|
|
1569
1511
|
var $;
|
|
1570
1512
|
(function ($) {
|
|
1571
|
-
$
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
1576
|
-
},
|
|
1577
|
-
});
|
|
1513
|
+
$.$mol_mem = $mol_wire_mem(0);
|
|
1514
|
+
$.$mol_mem_key = $mol_wire_mem(1);
|
|
1515
|
+
$.$mol_mem_key2 = $mol_wire_mem(2);
|
|
1516
|
+
$.$mol_mem_key3 = $mol_wire_mem(3);
|
|
1578
1517
|
})($ || ($ = {}));
|
|
1579
|
-
//mol/
|
|
1580
|
-
;
|
|
1581
|
-
"use strict";
|
|
1582
|
-
var $;
|
|
1583
|
-
(function ($_1) {
|
|
1584
|
-
$mol_test({
|
|
1585
|
-
'Cached field'($) {
|
|
1586
|
-
class App extends $mol_object2 {
|
|
1587
|
-
static $ = $;
|
|
1588
|
-
static low = 1;
|
|
1589
|
-
static get high() {
|
|
1590
|
-
return this.low + 1;
|
|
1591
|
-
}
|
|
1592
|
-
static set high(next) {
|
|
1593
|
-
this.low = next - 1;
|
|
1594
|
-
}
|
|
1595
|
-
static test() {
|
|
1596
|
-
$mol_assert_equal(App.high, 2);
|
|
1597
|
-
App.high = 3;
|
|
1598
|
-
$mol_assert_equal(App.high, 3);
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
__decorate([
|
|
1602
|
-
$mol_wire_field
|
|
1603
|
-
], App, "low", void 0);
|
|
1604
|
-
__decorate([
|
|
1605
|
-
$mol_wire_field
|
|
1606
|
-
], App, "high", null);
|
|
1607
|
-
__decorate([
|
|
1608
|
-
$mol_wire_method
|
|
1609
|
-
], App, "test", null);
|
|
1610
|
-
App.test();
|
|
1611
|
-
},
|
|
1612
|
-
});
|
|
1613
|
-
})($ || ($ = {}));
|
|
1614
|
-
//mol/wire/field/field.test.ts
|
|
1518
|
+
//mol/mem/mem.ts
|
|
1615
1519
|
;
|
|
1616
1520
|
"use strict";
|
|
1617
1521
|
var $;
|
|
@@ -1687,6 +1591,115 @@ var $;
|
|
|
1687
1591
|
//mol/log3/log3.web.ts
|
|
1688
1592
|
;
|
|
1689
1593
|
"use strict";
|
|
1594
|
+
var $;
|
|
1595
|
+
(function ($) {
|
|
1596
|
+
class $mol_wire_log extends $mol_object2 {
|
|
1597
|
+
static watch(task) {
|
|
1598
|
+
return task;
|
|
1599
|
+
}
|
|
1600
|
+
static track(fiber) {
|
|
1601
|
+
const prev = $mol_wire_probe(() => this.track(fiber));
|
|
1602
|
+
let next;
|
|
1603
|
+
try {
|
|
1604
|
+
next = fiber.sync();
|
|
1605
|
+
}
|
|
1606
|
+
finally {
|
|
1607
|
+
for (const pub of fiber.pub_list) {
|
|
1608
|
+
if (pub instanceof $mol_wire_fiber) {
|
|
1609
|
+
this.track(pub);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
if (prev !== undefined && !$mol_compare_deep(prev, next)) {
|
|
1614
|
+
this.$.$mol_log3_rise({
|
|
1615
|
+
message: 'Changed',
|
|
1616
|
+
place: fiber,
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
return next;
|
|
1620
|
+
}
|
|
1621
|
+
static active() {
|
|
1622
|
+
try {
|
|
1623
|
+
this.watch()?.();
|
|
1624
|
+
}
|
|
1625
|
+
finally {
|
|
1626
|
+
for (const pub of $mol_wire_auto.pub_list) {
|
|
1627
|
+
if (pub instanceof $mol_wire_fiber) {
|
|
1628
|
+
this.track(pub);
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
__decorate([
|
|
1635
|
+
$mol_mem
|
|
1636
|
+
], $mol_wire_log, "watch", null);
|
|
1637
|
+
__decorate([
|
|
1638
|
+
$mol_mem_key
|
|
1639
|
+
], $mol_wire_log, "track", null);
|
|
1640
|
+
__decorate([
|
|
1641
|
+
$mol_mem
|
|
1642
|
+
], $mol_wire_log, "active", null);
|
|
1643
|
+
$.$mol_wire_log = $mol_wire_log;
|
|
1644
|
+
})($ || ($ = {}));
|
|
1645
|
+
//mol/wire/log/log.ts
|
|
1646
|
+
;
|
|
1647
|
+
"use strict";
|
|
1648
|
+
var $;
|
|
1649
|
+
(function ($) {
|
|
1650
|
+
$mol_wire_log.active();
|
|
1651
|
+
})($ || ($ = {}));
|
|
1652
|
+
//mol/wire/wire.test.ts
|
|
1653
|
+
;
|
|
1654
|
+
"use strict";
|
|
1655
|
+
var $;
|
|
1656
|
+
(function ($) {
|
|
1657
|
+
$mol_test({
|
|
1658
|
+
'const returns stored value'() {
|
|
1659
|
+
const foo = { bar: $mol_const(Math.random()) };
|
|
1660
|
+
$mol_assert_equal(foo.bar(), foo.bar());
|
|
1661
|
+
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
1662
|
+
},
|
|
1663
|
+
});
|
|
1664
|
+
})($ || ($ = {}));
|
|
1665
|
+
//mol/const/const.test.ts
|
|
1666
|
+
;
|
|
1667
|
+
"use strict";
|
|
1668
|
+
var $;
|
|
1669
|
+
(function ($_1) {
|
|
1670
|
+
$mol_test({
|
|
1671
|
+
'Cached field'($) {
|
|
1672
|
+
class App extends $mol_object2 {
|
|
1673
|
+
static $ = $;
|
|
1674
|
+
static low = 1;
|
|
1675
|
+
static get high() {
|
|
1676
|
+
return this.low + 1;
|
|
1677
|
+
}
|
|
1678
|
+
static set high(next) {
|
|
1679
|
+
this.low = next - 1;
|
|
1680
|
+
}
|
|
1681
|
+
static test() {
|
|
1682
|
+
$mol_assert_equal(App.high, 2);
|
|
1683
|
+
App.high = 3;
|
|
1684
|
+
$mol_assert_equal(App.high, 3);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
__decorate([
|
|
1688
|
+
$mol_wire_field
|
|
1689
|
+
], App, "low", void 0);
|
|
1690
|
+
__decorate([
|
|
1691
|
+
$mol_wire_field
|
|
1692
|
+
], App, "high", null);
|
|
1693
|
+
__decorate([
|
|
1694
|
+
$mol_wire_method
|
|
1695
|
+
], App, "test", null);
|
|
1696
|
+
App.test();
|
|
1697
|
+
},
|
|
1698
|
+
});
|
|
1699
|
+
})($ || ($ = {}));
|
|
1700
|
+
//mol/wire/field/field.test.ts
|
|
1701
|
+
;
|
|
1702
|
+
"use strict";
|
|
1690
1703
|
//mol/type/equals/equals.test.ts
|
|
1691
1704
|
;
|
|
1692
1705
|
"use strict";
|