Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State<TContext, TEvent, TStateSchema, TTypestate>

Type parameters

Hierarchy

  • State

Index

Constructors

constructor

Properties

_event

_event: Event<TEvent>

_sessionid

_sessionid: string | null

actions

actions: Array<ActionObject<TContext, TEvent>> = []

activities

activities: ActivityMap = EMPTY_ACTIVITY_MAP

changed

changed: boolean | undefined

Indicates whether the state has changed from the previous state. A state is considered "changed" if:

  • Its value is not equal to its previous value, or:
  • It has any new actions (side-effects) to execute.

An initial state (with no history) will return undefined.

children

children: Record<string, ActorRef<any>>

An object mapping actor IDs to spawned actors/invoked services.

configuration

configuration: Array<StateNode<TContext, any, TEvent, any>>

The enabled state nodes representative of the state value.

context

context: TContext

done

done: boolean | undefined

Indicates whether the state is a final state.

event

event: TEvent

events

events: TEvent[] = []

Optional history

history: State<TContext, TEvent, TStateSchema, TTypestate>

Optional historyValue

historyValue: HistoryValue | undefined

meta

meta: any

nextEvents

nextEvents: EventType[]

The next events that will cause a transition from the current state.

transitions

transitions: Array<TransitionDefinition<TContext, TEvent>>

The transition definitions that resulted in this state.

value

value: StateValue

Methods

matches

  • matches<TSV>(parentStateValue: TSV): this is State<TEvent, TStateSchema, TTypestate> & { value: TSV }
  • Whether the current state value is a subset of the given parent state value.

    Type parameters

    • TSV: TTypestate["value"]

    Parameters

    • parentStateValue: TSV

    Returns this is State<TEvent, TStateSchema, TTypestate> & { value: TSV }

toJSON

  • toJSON(): {}

toStrings

  • toStrings(stateValue?: StateValue, delimiter?: string): string[]
  • Returns an array of all the string leaf state node paths.

    Parameters

    • Default value stateValue: StateValue = this.value
    • Default value delimiter: string = "."

      The character(s) that separate each subpath in the string state node path.

    Returns string[]

Static create

Static from

  • from<TC, TE>(stateValue: State<TC, TE, any, any> | StateValue, context?: TC | undefined): State<TC, TE, any, any>
  • Creates a new State instance for the given stateValue and context.

    Type parameters

    Parameters

    • stateValue: State<TC, TE, any, any> | StateValue
    • Optional context: TC | undefined

    Returns State<TC, TE, any, any>

Static inert

  • Creates a new State instance for the given stateValue and context with no actions (side-effects).

    Type parameters

    Parameters

    Returns State<TC, TE>

Generated using TypeDoc