Actions are side-effects that are executed on state transitions.
There are two kinds of actions:
Instead of define a transition target as simply a keyword, you need to use the full form:
{:on {:some-event {:target :some-state
:actions some-action}}}
Actions can also be a vector:
{:on {:some-event {:target :some-state
:actions [action1 action2]}}}
Entry actions are defined on a state, and are executed whenever this state is entered.
{:states
{:s1 {:entry some-action-on-entry
:exit some-action-on-exit
:on {...}}}}
;; entry/exit can also be vector of actions
{:states
{:s1 {:entry [action1 action2]
:entry [action3 action4]
:on {...}}}}
Actions can update the context of the state machine.
{{< loadcode "samples/src/statecharts-samples/trigger_actions.clj" >}}
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close