StateMachine.Introspection (state_machine v0.1.6)

Introspection functions allow you to collect and analyze meta information about state machine in runtime. For example, you might want to send the full list of states or events to the front-end, so that appropriate control or scale could be rendered. It is also possible to generate the list of currently allowed events, but be careful, this operation can be expensive if you use guards with side-effects.

Link to this section Summary

Functions

Returns a list of all events of the supplied state machine definition.

Returns a list of all states of the supplied state machine definition.

Returns a list of available events. This function takes a context with populated model, this is necessary to get a current state.

Link to this section Functions

Specs

all_events(StateMachine.t(any())) :: [atom()]

Returns a list of all events of the supplied state machine definition.

Specs

all_states(StateMachine.t(any())) :: [atom()]

Returns a list of all states of the supplied state machine definition.

Link to this function

allowed_events(ctx)

Specs

allowed_events(StateMachine.Context.t(any())) :: [atom()]

Returns a list of available events. This function takes a context with populated model, this is necessary to get a current state.