mol_jsx_lib 0.0.1014 → 0.0.1016

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
@@ -1467,21 +1467,28 @@ var $;
1467
1467
  "use strict";
1468
1468
  var $;
1469
1469
  (function ($) {
1470
- class $mol_after_timeout extends $mol_object2 {
1471
- delay;
1470
+ class $mol_after_tick extends $mol_object2 {
1472
1471
  task;
1473
- id;
1474
- constructor(delay, task) {
1472
+ static promise = null;
1473
+ cancelled = false;
1474
+ constructor(task) {
1475
1475
  super();
1476
- this.delay = delay;
1477
1476
  this.task = task;
1478
- this.id = setTimeout(task, delay);
1477
+ if (!$mol_after_tick.promise)
1478
+ $mol_after_tick.promise = Promise.resolve().then(() => {
1479
+ $mol_after_tick.promise = null;
1480
+ });
1481
+ $mol_after_tick.promise.then(() => {
1482
+ if (this.cancelled)
1483
+ return;
1484
+ task();
1485
+ });
1479
1486
  }
1480
1487
  destructor() {
1481
- clearTimeout(this.id);
1488
+ this.cancelled = true;
1482
1489
  }
1483
1490
  }
1484
- $.$mol_after_timeout = $mol_after_timeout;
1491
+ $.$mol_after_tick = $mol_after_tick;
1485
1492
  })($ || ($ = {}));
1486
1493
 
1487
1494
  ;
@@ -1499,7 +1506,7 @@ var $;
1499
1506
  static plan() {
1500
1507
  if (this.plan_task)
1501
1508
  return;
1502
- this.plan_task = new $mol_after_timeout(0, () => {
1509
+ this.plan_task = new $mol_after_tick(() => {
1503
1510
  try {
1504
1511
  this.sync();
1505
1512
  }
@@ -1773,6 +1780,27 @@ var $;
1773
1780
  $.$mol_key = $mol_key;
1774
1781
  })($ || ($ = {}));
1775
1782
 
1783
+ ;
1784
+ "use strict";
1785
+ var $;
1786
+ (function ($) {
1787
+ class $mol_after_timeout extends $mol_object2 {
1788
+ delay;
1789
+ task;
1790
+ id;
1791
+ constructor(delay, task) {
1792
+ super();
1793
+ this.delay = delay;
1794
+ this.task = task;
1795
+ this.id = setTimeout(task, delay);
1796
+ }
1797
+ destructor() {
1798
+ clearTimeout(this.id);
1799
+ }
1800
+ }
1801
+ $.$mol_after_timeout = $mol_after_timeout;
1802
+ })($ || ($ = {}));
1803
+
1776
1804
  ;
1777
1805
  "use strict";
1778
1806
  var $;
package/node.test.js CHANGED
@@ -1458,21 +1458,28 @@ var $;
1458
1458
  "use strict";
1459
1459
  var $;
1460
1460
  (function ($) {
1461
- class $mol_after_timeout extends $mol_object2 {
1462
- delay;
1461
+ class $mol_after_tick extends $mol_object2 {
1463
1462
  task;
1464
- id;
1465
- constructor(delay, task) {
1463
+ static promise = null;
1464
+ cancelled = false;
1465
+ constructor(task) {
1466
1466
  super();
1467
- this.delay = delay;
1468
1467
  this.task = task;
1469
- this.id = setTimeout(task, delay);
1468
+ if (!$mol_after_tick.promise)
1469
+ $mol_after_tick.promise = Promise.resolve().then(() => {
1470
+ $mol_after_tick.promise = null;
1471
+ });
1472
+ $mol_after_tick.promise.then(() => {
1473
+ if (this.cancelled)
1474
+ return;
1475
+ task();
1476
+ });
1470
1477
  }
1471
1478
  destructor() {
1472
- clearTimeout(this.id);
1479
+ this.cancelled = true;
1473
1480
  }
1474
1481
  }
1475
- $.$mol_after_timeout = $mol_after_timeout;
1482
+ $.$mol_after_tick = $mol_after_tick;
1476
1483
  })($ || ($ = {}));
1477
1484
 
1478
1485
  ;
@@ -1490,7 +1497,7 @@ var $;
1490
1497
  static plan() {
1491
1498
  if (this.plan_task)
1492
1499
  return;
1493
- this.plan_task = new $mol_after_timeout(0, () => {
1500
+ this.plan_task = new $mol_after_tick(() => {
1494
1501
  try {
1495
1502
  this.sync();
1496
1503
  }
@@ -1764,6 +1771,27 @@ var $;
1764
1771
  $.$mol_key = $mol_key;
1765
1772
  })($ || ($ = {}));
1766
1773
 
1774
+ ;
1775
+ "use strict";
1776
+ var $;
1777
+ (function ($) {
1778
+ class $mol_after_timeout extends $mol_object2 {
1779
+ delay;
1780
+ task;
1781
+ id;
1782
+ constructor(delay, task) {
1783
+ super();
1784
+ this.delay = delay;
1785
+ this.task = task;
1786
+ this.id = setTimeout(task, delay);
1787
+ }
1788
+ destructor() {
1789
+ clearTimeout(this.id);
1790
+ }
1791
+ }
1792
+ $.$mol_after_timeout = $mol_after_timeout;
1793
+ })($ || ($ = {}));
1794
+
1767
1795
  ;
1768
1796
  "use strict";
1769
1797
  var $;
@@ -3542,7 +3570,7 @@ var $;
3542
3570
  var $;
3543
3571
  (function ($_1) {
3544
3572
  $mol_test_mocks.push($ => {
3545
- $.$mol_after_timeout = $mol_after_mock_timeout;
3573
+ $.$mol_after_tick = $mol_after_mock_commmon;
3546
3574
  });
3547
3575
  })($ || ($ = {}));
3548
3576
 
@@ -3689,6 +3717,15 @@ var $;
3689
3717
  });
3690
3718
  })($ || ($ = {}));
3691
3719
 
3720
+ ;
3721
+ "use strict";
3722
+ var $;
3723
+ (function ($_1) {
3724
+ $mol_test_mocks.push($ => {
3725
+ $.$mol_after_timeout = $mol_after_mock_timeout;
3726
+ });
3727
+ })($ || ($ = {}));
3728
+
3692
3729
  ;
3693
3730
  "use strict";
3694
3731
  var $;