jssm 5.56.2 → 5.57.0
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/es6/jssm.d.ts +2 -0
- package/dist/es6/jssm.js +12 -4
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/jssm.d.ts +2 -0
- package/package.json +1 -1
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -41,9 +41,11 @@ declare class Machine<mDT> {
|
|
|
41
41
|
_has_basic_hooks: boolean;
|
|
42
42
|
_has_named_hooks: boolean;
|
|
43
43
|
_has_entry_hooks: boolean;
|
|
44
|
+
_has_exit_hooks: boolean;
|
|
44
45
|
_hooks: Map<string, Function>;
|
|
45
46
|
_named_hooks: Map<string, Function>;
|
|
46
47
|
_entry_hooks: Map<string, Function>;
|
|
48
|
+
_exit_hooks: Map<string, Function>;
|
|
47
49
|
_any_transition_hook: HookHandler | undefined;
|
|
48
50
|
constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout }: JssmGenericConfig<mDT>);
|
|
49
51
|
_new_state(state_config: JssmGenericState): StateType;
|
package/dist/es6/jssm.js
CHANGED
|
@@ -349,10 +349,12 @@ class Machine {
|
|
|
349
349
|
this._has_basic_hooks = false;
|
|
350
350
|
this._has_named_hooks = false;
|
|
351
351
|
this._has_entry_hooks = false;
|
|
352
|
+
this._has_exit_hooks = false;
|
|
352
353
|
// no need for a boolean has any transition hook, as it's one or nothing, so just test that for undefinedness
|
|
353
354
|
this._hooks = new Map();
|
|
354
355
|
this._named_hooks = new Map();
|
|
355
356
|
this._entry_hooks = new Map();
|
|
357
|
+
this._exit_hooks = new Map();
|
|
356
358
|
this._any_transition_hook = undefined;
|
|
357
359
|
if (state_declaration) {
|
|
358
360
|
state_declaration.map((state_decl) => {
|
|
@@ -724,9 +726,10 @@ class Machine {
|
|
|
724
726
|
this._entry_hooks.set(HookDesc.to, HookDesc.handler);
|
|
725
727
|
this._has_hooks = true;
|
|
726
728
|
break;
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
729
|
+
case 'exit':
|
|
730
|
+
this._exit_hooks.set(HookDesc.from, HookDesc.handler);
|
|
731
|
+
this._has_hooks = true;
|
|
732
|
+
break;
|
|
730
733
|
default:
|
|
731
734
|
console.log(`Unknown hook type ${HookDesc.kind}, should be impossible`);
|
|
732
735
|
throw new RangeError(`Unknown hook type ${HookDesc.kind}, should be impossible`);
|
|
@@ -789,7 +792,12 @@ class Machine {
|
|
|
789
792
|
}
|
|
790
793
|
}
|
|
791
794
|
// 3. exit hook
|
|
792
|
-
|
|
795
|
+
const maybe_ex_hook = this._exit_hooks.get(this._state);
|
|
796
|
+
if (maybe_ex_hook !== undefined) {
|
|
797
|
+
if (maybe_ex_hook({ from: this._state, forced: wasForced }) === false) {
|
|
798
|
+
return false;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
793
801
|
// 4. named transition / action hook
|
|
794
802
|
if (wasAction) {
|
|
795
803
|
const nhn = named_hook_name(this._state, newState, newStateOrAction), n_maybe_hook = this._named_hooks.get(nhn);
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.
|
|
1
|
+
const version = "5.57.0";
|
|
2
2
|
export { version };
|