StateMachine.Context (state_machine v0.1.6)

Context is a container for all metadata supporting the transition. Normally users should not have anything to do with Contexts, however some public functions might expose it. For example, user can (but discuraged) manipulate the Context in callbacks.

Link to this section Summary

Functions

Builds a fresh context based on State Machine definition and a model struct.

Link to this section Types

Specs

t(model) :: %StateMachine.Context{
  definition: StateMachine.t(model),
  error: any(),
  event: atom(),
  model: model,
  payload: any(),
  status: :init | :failed | :done,
  transition: StateMachine.Transition.t(model) | nil
}

Link to this section Functions

Link to this function

build(definition, model)

Specs

build(StateMachine.t(model), model) :: t(model) when model: var

Builds a fresh context based on State Machine definition and a model struct.