Skip to content

Commit

Permalink
Adds call points in set_hook for basic post-hooks, fixes #958
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Jul 1, 2022
1 parent bb3c001 commit e5bfa2a
Show file tree
Hide file tree
Showing 17 changed files with 529 additions and 75 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.long.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

936 merges; 124 releases
937 merges; 124 releases



Expand All @@ -18,6 +18,21 @@ Published tags:



 

 

## [Untagged] - 6/30/2022 6:03:58 PM

Commit [bb3c0014580c940b1294e19e64ac432c44bb7081](https://github.com/StoneCypher/jssm/commit/bb3c0014580c940b1294e19e64ac432c44bb7081)

Author: `John Haugeland <stonecypher@gmail.com>`

* Adds posthook path; fixes StoneCypher/fsl#956. Clones datastructures; fixes StoneCypher/fsl#957.




&nbsp;

&nbsp;
Expand Down
34 changes: 17 additions & 17 deletions CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

936 merges; 124 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
937 merges; 124 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)



Expand All @@ -18,6 +18,21 @@ Published tags:



&nbsp;

&nbsp;

## [Untagged] - 6/30/2022 6:03:58 PM

Commit [bb3c0014580c940b1294e19e64ac432c44bb7081](https://github.com/StoneCypher/jssm/commit/bb3c0014580c940b1294e19e64ac432c44bb7081)

Author: `John Haugeland <stonecypher@gmail.com>`

* Adds posthook path; fixes StoneCypher/fsl#956. Clones datastructures; fixes StoneCypher/fsl#957.




&nbsp;

&nbsp;
Expand Down Expand Up @@ -165,19 +180,4 @@ Commit [3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9](https://github.com/StoneCypher

Author: `John Haugeland <stonecypher@gmail.com>`

* everything now tested but standard and main




&nbsp;

&nbsp;

## [Untagged] - 6/25/2022 6:50:50 AM

Commit [e74cb836ae9c06a3261658ee969506c8dd3c9a24](https://github.com/StoneCypher/jssm/commit/e74cb836ae9c06a3261658ee969506c8dd3c9a24)

Author: `John Haugeland <stonecypher@gmail.com>`

* six data kinds tested
* everything now tested but standard and main
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -18,7 +18,7 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
* Generated for version 5.74.0 at 6/30/2022, 6:02:18 PM
* Generated for version 5.74.0 at 7/1/2022, 3:59:15 PM
-->
# jssm
Expand Down
58 changes: 58 additions & 0 deletions dist/es6/jssm.js
Expand Up @@ -1271,6 +1271,64 @@ class Machine {
this._has_hooks = true;
this._has_exit_hooks = true;
break;
case 'post hook':
this._hooks.set(hook_name(HookDesc.from, HookDesc.to), HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_basic_hooks = true;
break;
case 'post named':
this._post_named_hooks.set(named_hook_name(HookDesc.from, HookDesc.to, HookDesc.action), HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_named_hooks = true;
break;
case 'post global action':
this._post_global_action_hooks.set(HookDesc.action, HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_post_global_action_hooks = true;
break;
case 'post any action':
this._post_any_action_hook = HookDesc.handler;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post standard transition':
this._post_standard_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post main transition':
this._post_main_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post forced transition':
this._post_forced_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post any transition':
this._post_any_transition_hook = HookDesc.handler;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post entry':
this._post_entry_hooks.set(HookDesc.to, HookDesc.handler);
this._has_post_entry_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post exit':
this._post_exit_hooks.set(HookDesc.from, HookDesc.handler);
this._has_post_exit_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
default:
throw new JssmError(this, `Unknown hook type ${HookDesc.kind}, should be impossible`);
}
Expand Down
51 changes: 50 additions & 1 deletion dist/es6/jssm_types.d.ts
Expand Up @@ -198,7 +198,55 @@ declare type ExitHook<mDT> = {
from: string;
handler: HookHandler<mDT>;
};
declare type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT>;
declare type PostBasicHookDescription<mDT> = {
kind: 'post hook';
from: string;
to: string;
handler: PostHookHandler<mDT>;
};
declare type PostHookDescriptionWithAction<mDT> = {
kind: 'post named';
from: string;
to: string;
action: string;
handler: PostHookHandler<mDT>;
};
declare type PostStandardTransitionHook<mDT> = {
kind: 'post standard transition';
handler: PostHookHandler<mDT>;
};
declare type PostMainTransitionHook<mDT> = {
kind: 'post main transition';
handler: PostHookHandler<mDT>;
};
declare type PostForcedTransitionHook<mDT> = {
kind: 'post forced transition';
handler: PostHookHandler<mDT>;
};
declare type PostAnyTransitionHook<mDT> = {
kind: 'post any transition';
handler: PostHookHandler<mDT>;
};
declare type PostGlobalActionHook<mDT> = {
kind: 'post global action';
action: string;
handler: PostHookHandler<mDT>;
};
declare type PostAnyActionHook<mDT> = {
kind: 'post any action';
handler: PostHookHandler<mDT>;
};
declare type PostEntryHook<mDT> = {
kind: 'post entry';
to: string;
handler: PostHookHandler<mDT>;
};
declare type PostExitHook<mDT> = {
kind: 'post exit';
from: string;
handler: PostHookHandler<mDT>;
};
declare type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT> | PostBasicHookDescription<mDT> | PostHookDescriptionWithAction<mDT> | PostGlobalActionHook<mDT> | PostAnyActionHook<mDT> | PostStandardTransitionHook<mDT> | PostMainTransitionHook<mDT> | PostForcedTransitionHook<mDT> | PostAnyTransitionHook<mDT> | PostEntryHook<mDT> | PostExitHook<mDT>;
declare type HookComplexResult<mDT> = {
pass: boolean;
state?: StateType;
Expand All @@ -209,6 +257,7 @@ declare type HookContext<mDT> = {
data: mDT;
};
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
declare type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
declare type JssmErrorExtendedInfo = {
requested_state?: StateType | undefined;
};
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions dist/jssm.es5.cjs.nonmin.js
Expand Up @@ -18080,6 +18080,64 @@ class Machine {
this._has_hooks = true;
this._has_exit_hooks = true;
break;
case 'post hook':
this._hooks.set(hook_name(HookDesc.from, HookDesc.to), HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_basic_hooks = true;
break;
case 'post named':
this._post_named_hooks.set(named_hook_name(HookDesc.from, HookDesc.to, HookDesc.action), HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_named_hooks = true;
break;
case 'post global action':
this._post_global_action_hooks.set(HookDesc.action, HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_post_global_action_hooks = true;
break;
case 'post any action':
this._post_any_action_hook = HookDesc.handler;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post standard transition':
this._post_standard_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post main transition':
this._post_main_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post forced transition':
this._post_forced_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post any transition':
this._post_any_transition_hook = HookDesc.handler;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post entry':
this._post_entry_hooks.set(HookDesc.to, HookDesc.handler);
this._has_post_entry_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post exit':
this._post_exit_hooks.set(HookDesc.from, HookDesc.handler);
this._has_post_exit_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
default:
throw new JssmError(this, `Unknown hook type ${HookDesc.kind}, should be impossible`);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.js

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions dist/jssm.es5.iife.nonmin.js
Expand Up @@ -18079,6 +18079,64 @@ var jssm = (function (exports) {
this._has_hooks = true;
this._has_exit_hooks = true;
break;
case 'post hook':
this._hooks.set(hook_name(HookDesc.from, HookDesc.to), HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_basic_hooks = true;
break;
case 'post named':
this._post_named_hooks.set(named_hook_name(HookDesc.from, HookDesc.to, HookDesc.action), HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_named_hooks = true;
break;
case 'post global action':
this._post_global_action_hooks.set(HookDesc.action, HookDesc.handler);
this._has_hooks = true;
this._has_post_hooks = true;
this._has_post_global_action_hooks = true;
break;
case 'post any action':
this._post_any_action_hook = HookDesc.handler;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post standard transition':
this._post_standard_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post main transition':
this._post_main_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post forced transition':
this._post_forced_transition_hook = HookDesc.handler;
this._has_post_transition_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post any transition':
this._post_any_transition_hook = HookDesc.handler;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post entry':
this._post_entry_hooks.set(HookDesc.to, HookDesc.handler);
this._has_post_entry_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
case 'post exit':
this._post_exit_hooks.set(HookDesc.from, HookDesc.handler);
this._has_post_exit_hooks = true;
this._has_hooks = true;
this._has_post_hooks = true;
break;
default:
throw new JssmError(this, `Unknown hook type ${HookDesc.kind}, should be impossible`);
}
Expand Down
42 changes: 21 additions & 21 deletions docs/docs/classes/Machine.html

Large diffs are not rendered by default.

0 comments on commit e5bfa2a

Please sign in to comment.