mol_wire_lib 1.0.1148 → 1.0.1149

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.mjs CHANGED
@@ -575,21 +575,28 @@ var $;
575
575
  "use strict";
576
576
  var $;
577
577
  (function ($) {
578
- class $mol_after_timeout extends $mol_object2 {
579
- delay;
578
+ class $mol_after_tick extends $mol_object2 {
580
579
  task;
581
- id;
582
- constructor(delay, task) {
580
+ static promise = null;
581
+ cancelled = false;
582
+ constructor(task) {
583
583
  super();
584
- this.delay = delay;
585
584
  this.task = task;
586
- this.id = setTimeout(task, delay);
585
+ if (!$mol_after_tick.promise)
586
+ $mol_after_tick.promise = Promise.resolve().then(() => {
587
+ $mol_after_tick.promise = null;
588
+ });
589
+ $mol_after_tick.promise.then(() => {
590
+ if (this.cancelled)
591
+ return;
592
+ task();
593
+ });
587
594
  }
588
595
  destructor() {
589
- clearTimeout(this.id);
596
+ this.cancelled = true;
590
597
  }
591
598
  }
592
- $.$mol_after_timeout = $mol_after_timeout;
599
+ $.$mol_after_tick = $mol_after_tick;
593
600
  })($ || ($ = {}));
594
601
 
595
602
  ;
@@ -622,7 +629,7 @@ var $;
622
629
  static plan() {
623
630
  if (this.plan_task)
624
631
  return;
625
- this.plan_task = new $mol_after_timeout(0, () => {
632
+ this.plan_task = new $mol_after_tick(() => {
626
633
  try {
627
634
  this.sync();
628
635
  }
@@ -1614,6 +1621,27 @@ var $;
1614
1621
  $.$mol_key = $mol_key;
1615
1622
  })($ || ($ = {}));
1616
1623
 
1624
+ ;
1625
+ "use strict";
1626
+ var $;
1627
+ (function ($) {
1628
+ class $mol_after_timeout extends $mol_object2 {
1629
+ delay;
1630
+ task;
1631
+ id;
1632
+ constructor(delay, task) {
1633
+ super();
1634
+ this.delay = delay;
1635
+ this.task = task;
1636
+ this.id = setTimeout(task, delay);
1637
+ }
1638
+ destructor() {
1639
+ clearTimeout(this.id);
1640
+ }
1641
+ }
1642
+ $.$mol_after_timeout = $mol_after_timeout;
1643
+ })($ || ($ = {}));
1644
+
1617
1645
  ;
1618
1646
  "use strict";
1619
1647
  var $;
package/node.test.js CHANGED
@@ -566,21 +566,28 @@ var $;
566
566
  "use strict";
567
567
  var $;
568
568
  (function ($) {
569
- class $mol_after_timeout extends $mol_object2 {
570
- delay;
569
+ class $mol_after_tick extends $mol_object2 {
571
570
  task;
572
- id;
573
- constructor(delay, task) {
571
+ static promise = null;
572
+ cancelled = false;
573
+ constructor(task) {
574
574
  super();
575
- this.delay = delay;
576
575
  this.task = task;
577
- this.id = setTimeout(task, delay);
576
+ if (!$mol_after_tick.promise)
577
+ $mol_after_tick.promise = Promise.resolve().then(() => {
578
+ $mol_after_tick.promise = null;
579
+ });
580
+ $mol_after_tick.promise.then(() => {
581
+ if (this.cancelled)
582
+ return;
583
+ task();
584
+ });
578
585
  }
579
586
  destructor() {
580
- clearTimeout(this.id);
587
+ this.cancelled = true;
581
588
  }
582
589
  }
583
- $.$mol_after_timeout = $mol_after_timeout;
590
+ $.$mol_after_tick = $mol_after_tick;
584
591
  })($ || ($ = {}));
585
592
 
586
593
  ;
@@ -613,7 +620,7 @@ var $;
613
620
  static plan() {
614
621
  if (this.plan_task)
615
622
  return;
616
- this.plan_task = new $mol_after_timeout(0, () => {
623
+ this.plan_task = new $mol_after_tick(() => {
617
624
  try {
618
625
  this.sync();
619
626
  }
@@ -1605,6 +1612,27 @@ var $;
1605
1612
  $.$mol_key = $mol_key;
1606
1613
  })($ || ($ = {}));
1607
1614
 
1615
+ ;
1616
+ "use strict";
1617
+ var $;
1618
+ (function ($) {
1619
+ class $mol_after_timeout extends $mol_object2 {
1620
+ delay;
1621
+ task;
1622
+ id;
1623
+ constructor(delay, task) {
1624
+ super();
1625
+ this.delay = delay;
1626
+ this.task = task;
1627
+ this.id = setTimeout(task, delay);
1628
+ }
1629
+ destructor() {
1630
+ clearTimeout(this.id);
1631
+ }
1632
+ }
1633
+ $.$mol_after_timeout = $mol_after_timeout;
1634
+ })($ || ($ = {}));
1635
+
1608
1636
  ;
1609
1637
  "use strict";
1610
1638
  var $;
@@ -3854,7 +3882,7 @@ var $;
3854
3882
  var $;
3855
3883
  (function ($_1) {
3856
3884
  $mol_test_mocks.push($ => {
3857
- $.$mol_after_timeout = $mol_after_mock_timeout;
3885
+ $.$mol_after_tick = $mol_after_mock_commmon;
3858
3886
  });
3859
3887
  })($ || ($ = {}));
3860
3888
 
@@ -4001,6 +4029,15 @@ var $;
4001
4029
  });
4002
4030
  })($ || ($ = {}));
4003
4031
 
4032
+ ;
4033
+ "use strict";
4034
+ var $;
4035
+ (function ($_1) {
4036
+ $mol_test_mocks.push($ => {
4037
+ $.$mol_after_timeout = $mol_after_mock_timeout;
4038
+ });
4039
+ })($ || ($ = {}));
4040
+
4004
4041
  ;
4005
4042
  "use strict";
4006
4043
  var $;