hyoo_sync_client 0.0.476 → 0.0.478

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
@@ -1857,21 +1857,28 @@ var $;
1857
1857
  "use strict";
1858
1858
  var $;
1859
1859
  (function ($) {
1860
- class $mol_after_timeout extends $mol_object2 {
1861
- delay;
1860
+ class $mol_after_tick extends $mol_object2 {
1862
1861
  task;
1863
- id;
1864
- constructor(delay, task) {
1862
+ static promise = null;
1863
+ cancelled = false;
1864
+ constructor(task) {
1865
1865
  super();
1866
- this.delay = delay;
1867
1866
  this.task = task;
1868
- this.id = setTimeout(task, delay);
1867
+ if (!$mol_after_tick.promise)
1868
+ $mol_after_tick.promise = Promise.resolve().then(() => {
1869
+ $mol_after_tick.promise = null;
1870
+ });
1871
+ $mol_after_tick.promise.then(() => {
1872
+ if (this.cancelled)
1873
+ return;
1874
+ task();
1875
+ });
1869
1876
  }
1870
1877
  destructor() {
1871
- clearTimeout(this.id);
1878
+ this.cancelled = true;
1872
1879
  }
1873
1880
  }
1874
- $.$mol_after_timeout = $mol_after_timeout;
1881
+ $.$mol_after_tick = $mol_after_tick;
1875
1882
  })($ || ($ = {}));
1876
1883
 
1877
1884
  ;
@@ -1889,7 +1896,7 @@ var $;
1889
1896
  static plan() {
1890
1897
  if (this.plan_task)
1891
1898
  return;
1892
- this.plan_task = new $mol_after_timeout(0, () => {
1899
+ this.plan_task = new $mol_after_tick(() => {
1893
1900
  try {
1894
1901
  this.sync();
1895
1902
  }
@@ -2163,6 +2170,27 @@ var $;
2163
2170
  $.$mol_key = $mol_key;
2164
2171
  })($ || ($ = {}));
2165
2172
 
2173
+ ;
2174
+ "use strict";
2175
+ var $;
2176
+ (function ($) {
2177
+ class $mol_after_timeout extends $mol_object2 {
2178
+ delay;
2179
+ task;
2180
+ id;
2181
+ constructor(delay, task) {
2182
+ super();
2183
+ this.delay = delay;
2184
+ this.task = task;
2185
+ this.id = setTimeout(task, delay);
2186
+ }
2187
+ destructor() {
2188
+ clearTimeout(this.id);
2189
+ }
2190
+ }
2191
+ $.$mol_after_timeout = $mol_after_timeout;
2192
+ })($ || ($ = {}));
2193
+
2166
2194
  ;
2167
2195
  "use strict";
2168
2196
  var $;
package/node.test.js CHANGED
@@ -1848,21 +1848,28 @@ var $;
1848
1848
  "use strict";
1849
1849
  var $;
1850
1850
  (function ($) {
1851
- class $mol_after_timeout extends $mol_object2 {
1852
- delay;
1851
+ class $mol_after_tick extends $mol_object2 {
1853
1852
  task;
1854
- id;
1855
- constructor(delay, task) {
1853
+ static promise = null;
1854
+ cancelled = false;
1855
+ constructor(task) {
1856
1856
  super();
1857
- this.delay = delay;
1858
1857
  this.task = task;
1859
- this.id = setTimeout(task, delay);
1858
+ if (!$mol_after_tick.promise)
1859
+ $mol_after_tick.promise = Promise.resolve().then(() => {
1860
+ $mol_after_tick.promise = null;
1861
+ });
1862
+ $mol_after_tick.promise.then(() => {
1863
+ if (this.cancelled)
1864
+ return;
1865
+ task();
1866
+ });
1860
1867
  }
1861
1868
  destructor() {
1862
- clearTimeout(this.id);
1869
+ this.cancelled = true;
1863
1870
  }
1864
1871
  }
1865
- $.$mol_after_timeout = $mol_after_timeout;
1872
+ $.$mol_after_tick = $mol_after_tick;
1866
1873
  })($ || ($ = {}));
1867
1874
 
1868
1875
  ;
@@ -1880,7 +1887,7 @@ var $;
1880
1887
  static plan() {
1881
1888
  if (this.plan_task)
1882
1889
  return;
1883
- this.plan_task = new $mol_after_timeout(0, () => {
1890
+ this.plan_task = new $mol_after_tick(() => {
1884
1891
  try {
1885
1892
  this.sync();
1886
1893
  }
@@ -2154,6 +2161,27 @@ var $;
2154
2161
  $.$mol_key = $mol_key;
2155
2162
  })($ || ($ = {}));
2156
2163
 
2164
+ ;
2165
+ "use strict";
2166
+ var $;
2167
+ (function ($) {
2168
+ class $mol_after_timeout extends $mol_object2 {
2169
+ delay;
2170
+ task;
2171
+ id;
2172
+ constructor(delay, task) {
2173
+ super();
2174
+ this.delay = delay;
2175
+ this.task = task;
2176
+ this.id = setTimeout(task, delay);
2177
+ }
2178
+ destructor() {
2179
+ clearTimeout(this.id);
2180
+ }
2181
+ }
2182
+ $.$mol_after_timeout = $mol_after_timeout;
2183
+ })($ || ($ = {}));
2184
+
2157
2185
  ;
2158
2186
  "use strict";
2159
2187
  var $;
@@ -6391,7 +6419,7 @@ var $;
6391
6419
  var $;
6392
6420
  (function ($_1) {
6393
6421
  $mol_test_mocks.push($ => {
6394
- $.$mol_after_timeout = $mol_after_mock_timeout;
6422
+ $.$mol_after_tick = $mol_after_mock_commmon;
6395
6423
  });
6396
6424
  })($ || ($ = {}));
6397
6425
 
@@ -6480,6 +6508,15 @@ var $;
6480
6508
  ;
6481
6509
  "use strict";
6482
6510
 
6511
+ ;
6512
+ "use strict";
6513
+ var $;
6514
+ (function ($_1) {
6515
+ $mol_test_mocks.push($ => {
6516
+ $.$mol_after_timeout = $mol_after_mock_timeout;
6517
+ });
6518
+ })($ || ($ = {}));
6519
+
6483
6520
  ;
6484
6521
  "use strict";
6485
6522
  var $;