State class​
Signature:
export declare class State<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TTag extends string, TResolvedTypesMeta = TypegenDisabled>
Constructors​
Constructor | Modifiers | Description |
---|---|---|
(constructor)(config, machine) | Creates a new State instance that represents the current state of a running machine. |
Properties​
Property | Modifiers | Type | Description |
---|---|---|---|
children | ComputeChildren<TActor> | An object mapping actor names to spawned/invoked actors. | |
configuration | Array<StateNode<TContext, TEvent>> | The enabled state nodes representative of the state value. | |
context | TContext | ||
error | unknown | The output data of the top-level finite state. | |
historyValue | Readonly<HistoryValue<TContext, TEvent>> | ||
machine | AnyStateMachine | ||
meta | readonly | Record<string, any> | |
nextEvents | readonly | Array<EventDescriptor<TEvent>> | The next events that will cause a transition from the current state. |
status | 'active' | 'done' | 'error' | 'stopped' | Indicates whether the state is a final state. | |
tags | Set<string> | ||
value | StateValue |
Methods​
Method | Modifiers | Description |
---|---|---|
can(event) | Determines whether sending the event will cause a non-forbidden transition to be selected, even if the transitions have no actions nor change the state value. | |
from(stateValue, context, machine) | static | Creates a new State instance for the given stateValue and context . |
hasTag(tag) | Whether the current state configuration has a state node with the specified tag . | |
matches(parentStateValue) | Whether the current state value is a subset of the given parent state value. | |
toJSON() | ||
toStrings(stateValue) | Returns an array of all the string leaf state node paths. |