mol_jsx_lib 0.0.1013 → 0.0.1015

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
@@ -798,21 +798,28 @@ var $;
798
798
  "use strict";
799
799
  var $;
800
800
  (function ($) {
801
- class $mol_after_timeout extends $mol_object2 {
802
- delay;
801
+ class $mol_after_tick extends $mol_object2 {
803
802
  task;
804
- id;
805
- constructor(delay, task) {
803
+ static promise = null;
804
+ cancelled = false;
805
+ constructor(task) {
806
806
  super();
807
- this.delay = delay;
808
807
  this.task = task;
809
- this.id = setTimeout(task, delay);
808
+ if (!$mol_after_tick.promise)
809
+ $mol_after_tick.promise = Promise.resolve().then(() => {
810
+ $mol_after_tick.promise = null;
811
+ });
812
+ $mol_after_tick.promise.then(() => {
813
+ if (this.cancelled)
814
+ return;
815
+ task();
816
+ });
810
817
  }
811
818
  destructor() {
812
- clearTimeout(this.id);
819
+ this.cancelled = true;
813
820
  }
814
821
  }
815
- $.$mol_after_timeout = $mol_after_timeout;
822
+ $.$mol_after_tick = $mol_after_tick;
816
823
  })($ || ($ = {}));
817
824
 
818
825
  ;
@@ -845,7 +852,7 @@ var $;
845
852
  static plan() {
846
853
  if (this.plan_task)
847
854
  return;
848
- this.plan_task = new $mol_after_timeout(0, () => {
855
+ this.plan_task = new $mol_after_tick(() => {
849
856
  try {
850
857
  this.sync();
851
858
  }
@@ -1926,6 +1933,27 @@ var $;
1926
1933
  $_1.$mol_object = $mol_object;
1927
1934
  })($ || ($ = {}));
1928
1935
 
1936
+ ;
1937
+ "use strict";
1938
+ var $;
1939
+ (function ($) {
1940
+ class $mol_after_timeout extends $mol_object2 {
1941
+ delay;
1942
+ task;
1943
+ id;
1944
+ constructor(delay, task) {
1945
+ super();
1946
+ this.delay = delay;
1947
+ this.task = task;
1948
+ this.id = setTimeout(task, delay);
1949
+ }
1950
+ destructor() {
1951
+ clearTimeout(this.id);
1952
+ }
1953
+ }
1954
+ $.$mol_after_timeout = $mol_after_timeout;
1955
+ })($ || ($ = {}));
1956
+
1929
1957
  ;
1930
1958
  "use strict";
1931
1959
  var $;
package/web.test.js CHANGED
@@ -565,7 +565,7 @@ var $;
565
565
  var $;
566
566
  (function ($_1) {
567
567
  $mol_test_mocks.push($ => {
568
- $.$mol_after_timeout = $mol_after_mock_timeout;
568
+ $.$mol_after_tick = $mol_after_mock_commmon;
569
569
  });
570
570
  })($ || ($ = {}));
571
571
 
@@ -1147,6 +1147,15 @@ var $;
1147
1147
  $mol_test_mocks.push($ => $.$mol_fail_log = () => false);
1148
1148
  })($ || ($ = {}));
1149
1149
 
1150
+ ;
1151
+ "use strict";
1152
+ var $;
1153
+ (function ($_1) {
1154
+ $mol_test_mocks.push($ => {
1155
+ $.$mol_after_timeout = $mol_after_mock_timeout;
1156
+ });
1157
+ })($ || ($ = {}));
1158
+
1150
1159
  ;
1151
1160
  "use strict";
1152
1161
  var $;