Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IInstance

Interface for state machine instance classes to implement, allowing users of state to create their own to suit their persistance and transaction management needs.

Hierarchy

  • IInstance

Implemented by

Index

Properties

root

root: State

The root element of a state machine model.

Methods

defer

  • defer(state: State, trigger: any): void
  • Adds a trigger event to the event pool for later evaluation (once the state machine has changed state).

    Parameters

    • state: State

      The state at which the trigger event was deferred at.

    • trigger: any

      The trigger event to defer.

    Returns void

evaluate

  • evaluate(trigger: any): boolean
  • Passes an event trigger to a state machine instance for evaluation, which may result in state transitions occurring.

    Parameters

    • trigger: any

      The event to pass in as a trigger.

    Returns boolean

    Returns true if the trigger caused a state change.

getLastKnownState

  • getLastKnownState(region: Region): State | undefined
  • Get the last known clean state for a given region.

    remarks

    This is the safe method to use to query state machine instances.

    Parameters

    • region: Region

      The region to get the last known state of.

    Returns State | undefined

    Returns the last known state of the given region or undefined if the region has not yet been entered.

getState

  • getState(region: Region): State
  • Returns the last entered state to the state machine runtime.

    Parameters

    • region: Region

      The region to get the last entered state of.

    Returns State

    Returns the last entered state for the given region.

getVertex

  • getVertex(region: Region): Vertex
  • Returns the last entered vertex to the state machine runtime.

    Parameters

    • region: Region

      The region to get the last entered vertex of.

    Returns Vertex

    Returns the last entered vertex for the given region.

setState

  • setState(state: State): void
  • Updates the transactional state of a region with the last entered state.

    remarks

    This should only be called by the state machine runtime, and implementors note, you also need to update the last entered vertex within this call.

    Parameters

    • state: State

      The state set as its parents last entered state.

    Returns void

setVertex

  • setVertex(vertex: Vertex): void
  • Updates the transactional state of a region with the last entered vertex.

    remarks

    This should only be called by the state machine runtime.

    Parameters

    • vertex: Vertex

      The vertex set as its parents last entered vertex.

    Returns void

Generated using TypeDoc