mol_wire_lib 1.0.25 → 1.0.29

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/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'() {
@@ -821,6 +763,64 @@ var $;
821
763
  ;
822
764
  "use strict";
823
765
  var $;
766
+ (function ($_1) {
767
+ $mol_test({
768
+ 'Collect deps'() {
769
+ const pub1 = new $mol_wire_pub;
770
+ const pub2 = new $mol_wire_pub;
771
+ const sub = new $mol_wire_pub_sub;
772
+ const bu1 = sub.track_on();
773
+ try {
774
+ pub1.track_promote();
775
+ pub2.track_promote();
776
+ pub2.track_promote();
777
+ }
778
+ finally {
779
+ sub.track_cut();
780
+ sub.track_off(bu1);
781
+ }
782
+ pub1.emit();
783
+ pub2.emit();
784
+ $mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
785
+ const bu2 = sub.track_on();
786
+ try {
787
+ pub1.track_promote();
788
+ pub1.track_promote();
789
+ pub2.track_promote();
790
+ }
791
+ finally {
792
+ sub.track_cut();
793
+ sub.track_off(bu2);
794
+ }
795
+ pub1.emit();
796
+ pub2.emit();
797
+ $mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
798
+ },
799
+ 'cyclic detection'($) {
800
+ const sub1 = new $mol_wire_pub_sub;
801
+ const sub2 = new $mol_wire_pub_sub;
802
+ const bu1 = sub1.track_on();
803
+ try {
804
+ const bu2 = sub2.track_on();
805
+ try {
806
+ $mol_assert_fail(() => sub1.track_promote(), 'Circular subscription');
807
+ }
808
+ finally {
809
+ sub2.track_cut();
810
+ sub2.track_off(bu2);
811
+ }
812
+ }
813
+ finally {
814
+ sub1.track_cut();
815
+ sub1.track_off(bu1);
816
+ }
817
+ },
818
+ });
819
+ })($ || ($ = {}));
820
+ //mol/wire/pub/sub/sub.test.ts
821
+ ;
822
+ "use strict";
823
+ var $;
824
824
  (function ($) {
825
825
  $mol_test({
826
826
  'Primitives'() {
@@ -1568,50 +1568,12 @@ var $;
1568
1568
  "use strict";
1569
1569
  var $;
1570
1570
  (function ($) {
1571
- $mol_test({
1572
- 'const returns stored value'() {
1573
- const foo = { bar: $mol_const(Math.random()) };
1574
- $mol_assert_equal(foo.bar(), foo.bar());
1575
- $mol_assert_equal(foo.bar(), foo.bar['()']);
1576
- },
1577
- });
1571
+ $.$mol_mem = $mol_wire_mem(0);
1572
+ $.$mol_mem_key = $mol_wire_mem(1);
1573
+ $.$mol_mem_key2 = $mol_wire_mem(2);
1574
+ $.$mol_mem_key3 = $mol_wire_mem(3);
1578
1575
  })($ || ($ = {}));
1579
- //mol/const/const.test.ts
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
1576
+ //mol/mem/mem.ts
1615
1577
  ;
1616
1578
  "use strict";
1617
1579
  var $;
@@ -1687,6 +1649,115 @@ var $;
1687
1649
  //mol/log3/log3.web.ts
1688
1650
  ;
1689
1651
  "use strict";
1652
+ var $;
1653
+ (function ($) {
1654
+ class $mol_wire_log extends $mol_object2 {
1655
+ static watch(task) {
1656
+ return task;
1657
+ }
1658
+ static track(fiber) {
1659
+ const prev = $mol_wire_probe(() => this.track(fiber));
1660
+ let next;
1661
+ try {
1662
+ next = fiber.sync();
1663
+ }
1664
+ finally {
1665
+ for (const pub of fiber.pub_list) {
1666
+ if (pub instanceof $mol_wire_fiber) {
1667
+ this.track(pub);
1668
+ }
1669
+ }
1670
+ }
1671
+ if (prev !== undefined && !$mol_compare_deep(prev, next)) {
1672
+ this.$.$mol_log3_rise({
1673
+ message: 'Changed',
1674
+ place: fiber,
1675
+ });
1676
+ }
1677
+ return next;
1678
+ }
1679
+ static active() {
1680
+ try {
1681
+ this.watch()?.();
1682
+ }
1683
+ finally {
1684
+ for (const pub of $mol_wire_auto.pub_list) {
1685
+ if (pub instanceof $mol_wire_fiber) {
1686
+ this.track(pub);
1687
+ }
1688
+ }
1689
+ }
1690
+ }
1691
+ }
1692
+ __decorate([
1693
+ $mol_mem
1694
+ ], $mol_wire_log, "watch", null);
1695
+ __decorate([
1696
+ $mol_mem_key
1697
+ ], $mol_wire_log, "track", null);
1698
+ __decorate([
1699
+ $mol_mem
1700
+ ], $mol_wire_log, "active", null);
1701
+ $.$mol_wire_log = $mol_wire_log;
1702
+ })($ || ($ = {}));
1703
+ //mol/wire/log/log.ts
1704
+ ;
1705
+ "use strict";
1706
+ var $;
1707
+ (function ($) {
1708
+ $mol_wire_log.active();
1709
+ })($ || ($ = {}));
1710
+ //mol/wire/wire.test.ts
1711
+ ;
1712
+ "use strict";
1713
+ var $;
1714
+ (function ($) {
1715
+ $mol_test({
1716
+ 'const returns stored value'() {
1717
+ const foo = { bar: $mol_const(Math.random()) };
1718
+ $mol_assert_equal(foo.bar(), foo.bar());
1719
+ $mol_assert_equal(foo.bar(), foo.bar['()']);
1720
+ },
1721
+ });
1722
+ })($ || ($ = {}));
1723
+ //mol/const/const.test.ts
1724
+ ;
1725
+ "use strict";
1726
+ var $;
1727
+ (function ($_1) {
1728
+ $mol_test({
1729
+ 'Cached field'($) {
1730
+ class App extends $mol_object2 {
1731
+ static $ = $;
1732
+ static low = 1;
1733
+ static get high() {
1734
+ return this.low + 1;
1735
+ }
1736
+ static set high(next) {
1737
+ this.low = next - 1;
1738
+ }
1739
+ static test() {
1740
+ $mol_assert_equal(App.high, 2);
1741
+ App.high = 3;
1742
+ $mol_assert_equal(App.high, 3);
1743
+ }
1744
+ }
1745
+ __decorate([
1746
+ $mol_wire_field
1747
+ ], App, "low", void 0);
1748
+ __decorate([
1749
+ $mol_wire_field
1750
+ ], App, "high", null);
1751
+ __decorate([
1752
+ $mol_wire_method
1753
+ ], App, "test", null);
1754
+ App.test();
1755
+ },
1756
+ });
1757
+ })($ || ($ = {}));
1758
+ //mol/wire/field/field.test.ts
1759
+ ;
1760
+ "use strict";
1690
1761
  //mol/type/equals/equals.test.ts
1691
1762
  ;
1692
1763
  "use strict";