Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/xstate/src/StateNode.ts>StateNode

State machines and statecharts for the modern web.
Go to Latest
class StateNode
import { StateNode } from "https://deno.land/x/xstate@xstate%405.0.0-beta.13/src/StateNode.ts";

Constructors

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

Type Parameters

optional
TContext extends MachineContext = MachineContext
optional
TEvent extends EventObject = EventObject

Properties

optional
always: Array<TransitionDefinition<TContext, TEvent>>
readonly
definition: StateNodeDefinition<TContext, TEvent>

The well-structured state node definition.

optional
description: string

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

readonly
events: Array<TEvent["type"]>

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

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

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
id: string

The unique ID of the state node.

readonly
invoke: Array<InvokeDefinition<TContext, TEvent>>

The behaviors invoked as actors by this state node.

key: string

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

machine: StateMachine<TContext, TEvent, any, any>

The root machine node.

optional
meta: any

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

The mapping of events to transitions.

order: number

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

optional
output: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>

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

readonly
ownEvents: Array<TEvent["type"]>

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

Excludes any inert events.

optional
parent: StateNode<TContext, TEvent>

The parent state node.

path: string[]

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

readonly
stateIds: string[]

All the state node IDs of this state node and its descendant state nodes.

The child state nodes.

tags: string[]
readonly
target: string | undefined

The target state value of the history state node, if it exists. This represents the default state value to transition to if no history value exists yet.

transitions: Array<TransitionDefinition<TContext, TEvent>>
type:
| "atomic"
| "compound"
| "parallel"
| "final"
| "history"

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