You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In xstate/fsm, identifying the actions to execute on a transition is relatively :) straightforward. The actions returned from a transition (for execution in the interpreter) are:
any onexit of the source
any actions of the transition
any onentry of the target
(all excluding any assign actions effecting the context, which are handled inside the transition by updating the returned context)
see next comment for as is xstate/fsm code for handling transition actions.
"In the presence of compound states, transitions no longer simply move from the current active state to a new active state, but from one set of active states to another." See 3.1.4 and 3.1.5 at https://www.w3.org/TR/scxml/
In particular the scxml spec describes in 3.1.5 that upon a transition, a sequence of onexit and onentry actions (along with defined transition actions) is required for all active states, dependig upon the source and target states.
Hence a function is required in xstate/fsm-plus to implement this logic and return an array of actions that are to be executed on a given transition from a source to target states.
The text was updated successfully, but these errors were encountered:
for reference - xstate/fsm as is functionality for handling transition actions:
Diagram shows asis xstate/fsm code for handling actions on transition (note this is after changes to replace JS destructuring which is not supported in Espruino JS).
1 extracts any transition actions from the transition object
2 build allActions array with actions concat with current state onExit actions plus target state onEntry actions
3 handles any assign actions and returns the modified context and any 'non assign' actions for returning from the transition.
In xstate/fsm, identifying the actions to execute on a transition is relatively :) straightforward. The actions returned from a transition (for execution in the interpreter) are:
(all excluding any assign actions effecting the context, which are handled inside the transition by updating the returned context)
see next comment for as is xstate/fsm code for handling transition actions.
"In the presence of compound states, transitions no longer simply move from the current active state to a new active state, but from one set of active states to another." See 3.1.4 and 3.1.5 at https://www.w3.org/TR/scxml/
In particular the scxml spec describes in 3.1.5 that upon a transition, a sequence of onexit and onentry actions (along with defined transition actions) is required for all active states, dependig upon the source and target states.
Hence a function is required in xstate/fsm-plus to implement this logic and return an array of actions that are to be executed on a given transition from a source to target states.
The text was updated successfully, but these errors were encountered: