@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.
package/dist/fsm/fsm.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const FSM_STARTING: number;
3
3
  export declare const FSM_PENDING: number;
4
4
  export declare const FSM_DONE: number;
5
5
  export declare const FSM_ERROR: number;
6
+ export declare const FSM_CANCEL: number;
6
7
  export declare const FSM_RELEASED: number;
7
8
  export declare const FSM_CUSTOM1: number;
8
9
  export declare const FSM_CUSTOM2: number;
@@ -44,6 +45,7 @@ export declare class Fsm {
44
45
  get ready(): boolean;
45
46
  get iserror(): boolean;
46
47
  get isDependentError(): boolean;
48
+ cancel(): void;
47
49
  setDependentError(): void;
48
50
  clearDependentError(): void;
49
51
  get ticked(): boolean;
package/lib/fsm/fsm.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  // Shared libraries
2
2
  import * as Util from '../util/all';
3
3
 
4
- // States
4
+ // States (note these are no longer bit flags - most uses create custom values incrementally from CUSTOM1)
5
5
  export const FSM_STARTING: number = 0;
6
6
  export const FSM_PENDING: number = 1<<0;
7
7
  export const FSM_DONE: number = 1<<1;
8
8
  export const FSM_ERROR: number = 1<<2;
9
+ export const FSM_CANCEL: number = 5;
9
10
  export const FSM_RELEASED: number = 1<<3;
10
11
  export const FSM_CUSTOM1: number = 1<<4;
11
12
  export const FSM_CUSTOM2: number = 1<<5;
@@ -22,7 +23,7 @@ let doLater: any = global && global.setImmediate ? setImmediate : (cb: any) => {
22
23
 
23
24
  function FsmDone(s: number): boolean
24
25
  {
25
- return (s === FSM_DONE || s === FSM_ERROR || s === FSM_RELEASED);
26
+ return (s === FSM_DONE || s === FSM_ERROR || s === FSM_RELEASED || s === FSM_CANCEL);
26
27
  }
27
28
 
28
29
  function FsmStateToString(state: number): string
@@ -151,7 +152,7 @@ export class Fsm
151
152
 
152
153
  get iserror(): boolean
153
154
  {
154
- return (this.state === FSM_ERROR);
155
+ return (this.state === FSM_ERROR || this.state === FSM_CANCEL);
155
156
  }
156
157
 
157
158
  get isDependentError(): boolean
@@ -159,6 +160,12 @@ export class Fsm
159
160
  return this.dependentError;
160
161
  }
161
162
 
163
+ cancel(): void
164
+ {
165
+ // Override if you need to do more than marking complete
166
+ this.setState(FSM_CANCEL);
167
+ }
168
+
162
169
  setDependentError(): void
163
170
  {
164
171
  this.dependentError = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.83",
3
+ "version": "1.0.84",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",