@dra2020/baseclient 1.0.6 → 1.0.9

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.
@@ -994,9 +994,17 @@ class FsmSleep extends Fsm {
994
994
  this.delay = delay;
995
995
  }
996
996
  tick() {
997
- if (this.ready && this.state === exports.FSM_STARTING) {
997
+ // This allows canceling by simply setting state to done
998
+ if (this.done && this.timeoutHandle !== undefined) {
999
+ clearTimeout(this.timeoutHandle);
1000
+ delete this.timeoutHandle;
1001
+ }
1002
+ else if (this.ready && this.state === exports.FSM_STARTING) {
998
1003
  this.setState(exports.FSM_PENDING);
999
- setTimeout(() => { this.setState(exports.FSM_DONE); }, this.delay);
1004
+ this.timeoutHandle = setTimeout(() => {
1005
+ delete this.timeoutHandle;
1006
+ this.setState(exports.FSM_DONE);
1007
+ }, this.delay);
1000
1008
  }
1001
1009
  }
1002
1010
  }
@@ -1375,10 +1383,9 @@ class GeoMultiCollection {
1375
1383
  let n = this.nEntries;
1376
1384
  if (n == 1)
1377
1385
  this.all.col = this._col(this.nthEntry(0));
1378
- else {
1379
- this.all.col = { type: 'FeatureCollection', features: [] };
1380
- this.forEach(f => { this.all.col.features.push(f); });
1381
- }
1386
+ else
1387
+ // Going from map to collection guarantees that any duplicates are removed
1388
+ this.all.col = geoMapToCollection(this.allMap());
1382
1389
  }
1383
1390
  return this.all.col;
1384
1391
  }
@@ -1390,8 +1397,11 @@ class GeoMultiCollection {
1390
1397
  let n = this.nEntries;
1391
1398
  if (n == 1)
1392
1399
  this.all.map = this._map(this.nthEntry(0));
1393
- else
1394
- this.all.map = geoCollectionToMap(this.allCol());
1400
+ else {
1401
+ let map = {};
1402
+ this.all.map = map;
1403
+ this.forEach(f => { map[String(f.properties.id)] = f; });
1404
+ }
1395
1405
  }
1396
1406
  return this.all.map;
1397
1407
  }