mol_wire_lib 1.0.1148 → 1.0.1150

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.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
  }
@@ -1674,6 +1681,27 @@ var $;
1674
1681
  $.$mol_mem_key = $mol_wire_plex;
1675
1682
  })($ || ($ = {}));
1676
1683
 
1684
+ ;
1685
+ "use strict";
1686
+ var $;
1687
+ (function ($) {
1688
+ class $mol_after_timeout extends $mol_object2 {
1689
+ delay;
1690
+ task;
1691
+ id;
1692
+ constructor(delay, task) {
1693
+ super();
1694
+ this.delay = delay;
1695
+ this.task = task;
1696
+ this.id = setTimeout(task, delay);
1697
+ }
1698
+ destructor() {
1699
+ clearTimeout(this.id);
1700
+ }
1701
+ }
1702
+ $.$mol_after_timeout = $mol_after_timeout;
1703
+ })($ || ($ = {}));
1704
+
1677
1705
  ;
1678
1706
  "use strict";
1679
1707
  var $;
package/web.test.js CHANGED
@@ -1129,7 +1129,7 @@ var $;
1129
1129
  var $;
1130
1130
  (function ($_1) {
1131
1131
  $mol_test_mocks.push($ => {
1132
- $.$mol_after_timeout = $mol_after_mock_timeout;
1132
+ $.$mol_after_tick = $mol_after_mock_commmon;
1133
1133
  });
1134
1134
  })($ || ($ = {}));
1135
1135
 
@@ -1298,6 +1298,15 @@ var $;
1298
1298
  $mol_test_mocks.push($ => $.$mol_fail_log = () => false);
1299
1299
  })($ || ($ = {}));
1300
1300
 
1301
+ ;
1302
+ "use strict";
1303
+ var $;
1304
+ (function ($_1) {
1305
+ $mol_test_mocks.push($ => {
1306
+ $.$mol_after_timeout = $mol_after_mock_timeout;
1307
+ });
1308
+ })($ || ($ = {}));
1309
+
1301
1310
  ;
1302
1311
  "use strict";
1303
1312
  var $;