StateMachine

class Communicator.Util.StateMachine()
Class

StateMachine<State, ActionNames> is a minimalist state machine

Interfaces

  • Action()

Type aliases

Constructors

Methods


Type aliases

StateReducer

type

{StateReducer<State, ActionNames>} The signature of the function that will handle actions.

param state

the current state of the state machine

param action

the action that triggered the reducer

returns

the next state of the state machine

Constructors

StateMachine.constructor(state, reducer)
Arguments
  • state (State()) –

  • reducer (StateReducer <State, ActionNames>) –

Return type

StateMachine()

Methods

handle

StateMachine.handle(evt[, payload])

Handle an action and update the state

Arguments
  • evt (ActionNames()) – The action to handle

  • payload (any()) – optional The payload if any

Return type

void