StateNode class​
Signature:
export declare class StateNode<TContext extends MachineContext = MachineContext, TEvent extends EventObject = EventObject>
Constructors​
Constructor | Modifiers | Description |
---|---|---|
(constructor)(config, options) | Constructs a new instance of the StateNode class |
Properties​
Property | Modifiers | Type | Description |
---|---|---|---|
after | readonly | Array<DelayedTransitionDefinition<TContext, TEvent>> | |
always? | Array<TransitionDefinition<TContext, TEvent>> | (Optional) | |
config | StateNodeConfig<TContext, TEvent, TODO, // actions TODO, // actors TODO, // output TODO, // guards TODO, // delays TODO> | The raw config used to create the machine. | |
definition | readonly | StateNodeDefinition<TContext, TEvent> | The well-structured state node definition. |
description? | string | (Optional) | |
entry | UnknownAction[] | The action(s) to be executed upon entering the state node. | |
events | readonly | Array<TEvent['type']> | All the event types accepted by this state node and its descendants. |
exit | UnknownAction[] | 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: - | |
id | string | The unique ID of the state node. | |
initial | readonly | InitialTransitionDefinition<TContext, TEvent> | |
invoke | readonly | Array<InvokeDefinition<TContext, TEvent, ProvidedActor, ParameterizedObject, ParameterizedObject, string>> | The logic 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, // actors any, // input TODO, // output TODO, // guards TODO, // delays TODO, // tags TODO> | The root machine node. | |
meta? | any | (Optional) The meta data associated with this state node, which will be returned in State instances. | |
on | readonly | TransitionDefinitionMap<TContext, TEvent> | The mapping of events to transitions. |
order | number | The order this state node appears. Corresponds to the implicit document order. | |
output? | Mapper<MachineContext, EventObject, unknown, EventObject> | NonReducibleUnknown | (Optional) The output data sent with the "xstate.done.state._id_" event if this is a final state node. | |
ownEvents | readonly | Array<TEvent['type']> | All the events that have transitions directly from this state node. Excludes any inert events. |
parent? | StateNode<TContext, TEvent> | (Optional) The parent state node. | |
path | string[] | The string path from the root machine node to this node. | |
states | StateNodesConfig<TContext, TEvent> | The child state nodes. | |
tags | string[] | ||
transitions | Map<string, TransitionDefinition<TContext, TEvent>[]> | ||
type | 'atomic' | 'compound' | 'parallel' | 'final' | 'history' | The type of this state node: - |
Methods​
Method | Modifiers | Description |
---|---|---|
_initialize() | ||
next(state, event) | ||
toJSON() |