@dra2020/baseclient 1.0.83 → 1.0.84

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.
@@ -1813,14 +1813,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
1813
1813
  return result;
1814
1814
  };
1815
1815
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1816
- exports.FsmArray = exports.FsmLoop = exports.DefaultLoopOptions = exports.FsmTracker = exports.FsmSerializer = exports.FsmSleep = exports.FsmOnDone = exports.Fsm = exports.FsmManager = exports.FSM_CUSTOM9 = exports.FSM_CUSTOM8 = exports.FSM_CUSTOM7 = exports.FSM_CUSTOM6 = exports.FSM_CUSTOM5 = exports.FSM_CUSTOM4 = exports.FSM_CUSTOM3 = exports.FSM_CUSTOM2 = exports.FSM_CUSTOM1 = exports.FSM_RELEASED = exports.FSM_ERROR = exports.FSM_DONE = exports.FSM_PENDING = exports.FSM_STARTING = void 0;
1816
+ exports.FsmArray = exports.FsmLoop = exports.DefaultLoopOptions = exports.FsmTracker = exports.FsmSerializer = exports.FsmSleep = exports.FsmOnDone = exports.Fsm = exports.FsmManager = exports.FSM_CUSTOM9 = exports.FSM_CUSTOM8 = exports.FSM_CUSTOM7 = exports.FSM_CUSTOM6 = exports.FSM_CUSTOM5 = exports.FSM_CUSTOM4 = exports.FSM_CUSTOM3 = exports.FSM_CUSTOM2 = exports.FSM_CUSTOM1 = exports.FSM_RELEASED = exports.FSM_CANCEL = exports.FSM_ERROR = exports.FSM_DONE = exports.FSM_PENDING = exports.FSM_STARTING = void 0;
1817
1817
  // Shared libraries
1818
1818
  const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
1819
- // States
1819
+ // States (note these are no longer bit flags - most uses create custom values incrementally from CUSTOM1)
1820
1820
  exports.FSM_STARTING = 0;
1821
1821
  exports.FSM_PENDING = 1 << 0;
1822
1822
  exports.FSM_DONE = 1 << 1;
1823
1823
  exports.FSM_ERROR = 1 << 2;
1824
+ exports.FSM_CANCEL = 5;
1824
1825
  exports.FSM_RELEASED = 1 << 3;
1825
1826
  exports.FSM_CUSTOM1 = 1 << 4;
1826
1827
  exports.FSM_CUSTOM2 = 1 << 5;
@@ -1834,7 +1835,7 @@ exports.FSM_CUSTOM9 = 1 << 12;
1834
1835
  // polyfill
1835
1836
  let doLater = global && global.setImmediate ? setImmediate : (cb) => { setTimeout(cb, 0); };
1836
1837
  function FsmDone(s) {
1837
- return (s === exports.FSM_DONE || s === exports.FSM_ERROR || s === exports.FSM_RELEASED);
1838
+ return (s === exports.FSM_DONE || s === exports.FSM_ERROR || s === exports.FSM_RELEASED || s === exports.FSM_CANCEL);
1838
1839
  }
1839
1840
  function FsmStateToString(state) {
1840
1841
  let a = [];
@@ -1928,11 +1929,15 @@ class Fsm {
1928
1929
  return !this.done && this._waitOn == null;
1929
1930
  }
1930
1931
  get iserror() {
1931
- return (this.state === exports.FSM_ERROR);
1932
+ return (this.state === exports.FSM_ERROR || this.state === exports.FSM_CANCEL);
1932
1933
  }
1933
1934
  get isDependentError() {
1934
1935
  return this.dependentError;
1935
1936
  }
1937
+ cancel() {
1938
+ // Override if you need to do more than marking complete
1939
+ this.setState(exports.FSM_CANCEL);
1940
+ }
1936
1941
  setDependentError() {
1937
1942
  this.dependentError = true;
1938
1943
  }