Skip to content

Commit

Permalink
Basic conversion to abstract hooks complete; fixes StoneCypher/fsl#931
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Jun 25, 2022
1 parent adfa906 commit d52217a
Show file tree
Hide file tree
Showing 15 changed files with 170 additions and 171 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.

921 merges; 114 releases
922 merges; 114 releases



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



 

 

## [Untagged] - 6/24/2022 7:36:27 PM

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

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

* the conversion continues




&nbsp;

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

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

921 merges; 114 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
922 merges; 114 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/24/2022 7:36:27 PM

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

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

* the conversion continues




&nbsp;

&nbsp;
Expand Down Expand Up @@ -154,21 +169,4 @@ Commit [a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a](https://github.com/StoneCypher

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

* another trigger commit with mild doc extension




&nbsp;

&nbsp;

<a name="5__70__33" />

## [5.70.33] - 6/18/2022 8:57:42 PM

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

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

* holy another facile build for triggering, batman
* another trigger commit with mild doc extension
6 changes: 3 additions & 3 deletions dist/es6/jssm.d.ts
Expand Up @@ -224,10 +224,10 @@ declare class Machine<mDT> {
_has_global_action_hooks: boolean;
_has_transition_hooks: boolean;
_hooks: Map<string, HookHandler<mDT>>;
_named_hooks: Map<string, Function>;
_named_hooks: Map<string, HookHandler<mDT>>;
_entry_hooks: Map<string, HookHandler<mDT>>;
_exit_hooks: Map<string, Function>;
_global_action_hooks: Map<string, Function>;
_exit_hooks: Map<string, HookHandler<mDT>>;
_global_action_hooks: Map<string, HookHandler<mDT>>;
_any_action_hook: HookHandler<mDT> | undefined;
_standard_transition_hook: HookHandler<mDT> | undefined;
_main_transition_hook: HookHandler<mDT> | undefined;
Expand Down
34 changes: 14 additions & 20 deletions dist/es6/jssm.js
Expand Up @@ -1333,42 +1333,36 @@ class Machine {
const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced };
if (wasAction) {
// 1. any action hook
if (this._any_action_hook !== undefined) {
if (this._any_action_hook(hook_args) === false) {
return false;
}
const outcome = AbstractHookStep(this._any_action_hook, hook_args);
if (outcome.pass === false) {
return false;
}
// 2. global specific action hook
const maybe_ga_hook = this._global_action_hooks.get(newStateOrAction);
if (maybe_ga_hook !== undefined) {
if (maybe_ga_hook(hook_args) === false) {
return false;
}
const outcome2 = AbstractHookStep(this._global_action_hooks.get(newStateOrAction), hook_args);
if (outcome2.pass === false) {
return false;
}
}
// 3. any transition hook
if (this._any_transition_hook !== undefined) {
if (this._any_transition_hook(hook_args) === false) {
const outcome = AbstractHookStep(this._any_transition_hook, hook_args);
if (outcome.pass === false) {
return false;
}
}
// 4. exit hook
if (this._has_exit_hooks) {
const maybe_ex_hook = this._exit_hooks.get(this._state);
if (maybe_ex_hook !== undefined) {
if (maybe_ex_hook(hook_args) === false) {
return false;
}
const outcome = AbstractHookStep(this._exit_hooks.get(this._state), hook_args);
if (outcome.pass === false) {
return false;
}
}
// 5. named transition / action hook
if (this._has_named_hooks) {
if (wasAction) {
const nhn = named_hook_name(this._state, newState, newStateOrAction), n_maybe_hook = this._named_hooks.get(nhn);
if (n_maybe_hook !== undefined) {
if (n_maybe_hook(hook_args) === false) {
return false;
}
const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = AbstractHookStep(this._named_hooks.get(nhn), hook_args);
if (outcome.pass === false) {
return false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

34 changes: 14 additions & 20 deletions dist/jssm.es5.cjs.nonmin.js
Expand Up @@ -18141,42 +18141,36 @@ class Machine {
const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced };
if (wasAction) {
// 1. any action hook
if (this._any_action_hook !== undefined) {
if (this._any_action_hook(hook_args) === false) {
return false;
}
const outcome = AbstractHookStep(this._any_action_hook, hook_args);
if (outcome.pass === false) {
return false;
}
// 2. global specific action hook
const maybe_ga_hook = this._global_action_hooks.get(newStateOrAction);
if (maybe_ga_hook !== undefined) {
if (maybe_ga_hook(hook_args) === false) {
return false;
}
const outcome2 = AbstractHookStep(this._global_action_hooks.get(newStateOrAction), hook_args);
if (outcome2.pass === false) {
return false;
}
}
// 3. any transition hook
if (this._any_transition_hook !== undefined) {
if (this._any_transition_hook(hook_args) === false) {
const outcome = AbstractHookStep(this._any_transition_hook, hook_args);
if (outcome.pass === false) {
return false;
}
}
// 4. exit hook
if (this._has_exit_hooks) {
const maybe_ex_hook = this._exit_hooks.get(this._state);
if (maybe_ex_hook !== undefined) {
if (maybe_ex_hook(hook_args) === false) {
return false;
}
const outcome = AbstractHookStep(this._exit_hooks.get(this._state), hook_args);
if (outcome.pass === false) {
return false;
}
}
// 5. named transition / action hook
if (this._has_named_hooks) {
if (wasAction) {
const nhn = named_hook_name(this._state, newState, newStateOrAction), n_maybe_hook = this._named_hooks.get(nhn);
if (n_maybe_hook !== undefined) {
if (n_maybe_hook(hook_args) === false) {
return false;
}
const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = AbstractHookStep(this._named_hooks.get(nhn), hook_args);
if (outcome.pass === false) {
return false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.js

Large diffs are not rendered by default.

34 changes: 14 additions & 20 deletions dist/jssm.es5.iife.nonmin.js
Expand Up @@ -18140,42 +18140,36 @@ var jssm = (function (exports) {
const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced };
if (wasAction) {
// 1. any action hook
if (this._any_action_hook !== undefined) {
if (this._any_action_hook(hook_args) === false) {
return false;
}
const outcome = AbstractHookStep(this._any_action_hook, hook_args);
if (outcome.pass === false) {
return false;
}
// 2. global specific action hook
const maybe_ga_hook = this._global_action_hooks.get(newStateOrAction);
if (maybe_ga_hook !== undefined) {
if (maybe_ga_hook(hook_args) === false) {
return false;
}
const outcome2 = AbstractHookStep(this._global_action_hooks.get(newStateOrAction), hook_args);
if (outcome2.pass === false) {
return false;
}
}
// 3. any transition hook
if (this._any_transition_hook !== undefined) {
if (this._any_transition_hook(hook_args) === false) {
const outcome = AbstractHookStep(this._any_transition_hook, hook_args);
if (outcome.pass === false) {
return false;
}
}
// 4. exit hook
if (this._has_exit_hooks) {
const maybe_ex_hook = this._exit_hooks.get(this._state);
if (maybe_ex_hook !== undefined) {
if (maybe_ex_hook(hook_args) === false) {
return false;
}
const outcome = AbstractHookStep(this._exit_hooks.get(this._state), hook_args);
if (outcome.pass === false) {
return false;
}
}
// 5. named transition / action hook
if (this._has_named_hooks) {
if (wasAction) {
const nhn = named_hook_name(this._state, newState, newStateOrAction), n_maybe_hook = this._named_hooks.get(nhn);
if (n_maybe_hook !== undefined) {
if (n_maybe_hook(hook_args) === false) {
return false;
}
const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = AbstractHookStep(this._named_hooks.get(nhn), hook_args);
if (outcome.pass === false) {
return false;
}
}
}
Expand Down
34 changes: 17 additions & 17 deletions docs/docs/classes/Machine.html

Large diffs are not rendered by default.

0 comments on commit d52217a

Please sign in to comment.