Skip to content

StateNode <TContext, TEvent>

Hierarchy

Index

Constructors

constructor

  • new StateNode<TContext, TEvent>(config: StateNodeConfig<TContext, TEvent, any, any, any, any, any, any>, options: StateNodeOptions<TContext, TEvent>): StateNode<TContext, TEvent>

Properties

publicoptionalalways

always?: TransitionDefinition<TContext, TEvent>[]

publicconfig

config: StateNodeConfig<TContext, TEvent, any, any, any, any, any, any>

The raw config used to create the machine.

publicoptionaldescription

description?: string

publicentry

entry: UnknownAction[]

The action(s) to be executed upon entering the state node.

publicexit

The action(s) to be executed upon exiting the state node.

publichistory

history: false | shallow | deep

The type of history on this state node. Can be:

  • 'shallow' - recalls only top-level historical state value
  • 'deep' - recalls historical state value at all levels

publicid

id: string

The unique ID of the state node.

publickey

key: string

The relative key of the state node, which represents its location in the overall state value.

publicmachine

machine: StateMachine<TContext, TEvent, any, any, any, any, any, any, any, any, any, ResolveTypegenMeta<TypegenDisabled, NoInfer<TEvent>, any, any, any, any, any>>

The root machine node.

publicoptionalmeta

meta?: any

The meta data associated with this state node, which will be returned in State instances.

publicorder

order: number = -1

The order this state node appears. Corresponds to the implicit document order.

publicoptionaloutput

The output data sent with the "xstate.done.state.id" event if this is a final state node.

publicoptionalparent

parent?: StateNode<TContext, TEvent>

The parent state node.

publicpath

path: string[]

The string path from the root machine node to this node.

publicstates

states: StateNodesConfig<TContext, TEvent>

The child state nodes.

publictags

tags: string[] = []

publictransitions

transitions: Map<string, TransitionDefinition<TContext, TEvent>[]>

publictype

type: history | atomic | compound | parallel | final

The type of this state node:

  • 'atomic' - no child state nodes
  • 'compound' - nested child state nodes (XOR)
  • 'parallel' - orthogonal nested child state nodes (AND)
  • 'history' - history state node
  • 'final' - final state node

Accessors

publicafter

publicdefinition

publicevents

  • All the event types accepted by this state node and its descendants.


    Returns EventDescriptor<TEvent>[]

publicinitial

publicinvoke

publicon

publicownEvents

  • All the events that have transitions directly from this state node.

    Excludes any inert events.


    Returns EventDescriptor<TEvent>[]

Methods

public_initialize

  • _initialize(): void
  • Returns void

publicnext

publictoJSON