StateMachine class​
Signature:
export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, TInput, TOutput, TResolvedTypesMeta = ResolveTypegenMeta<TypegenDisabled, NoInfer<TEvent>, TActor, TAction, TGuard, TDelay, TTag>> implements ActorLogic<MachineSnapshot<TContext, TEvent, TActor, TTag, TOutput, TResolvedTypesMeta>, TEvent, TInput, TODO>
Implements: ActorLogic<MachineSnapshot<TContext, TEvent, TActor, TTag, TOutput, TResolvedTypesMeta>, TEvent, TInput, TODO>
Constructors​
Constructor | Modifiers | Description |
---|---|---|
(constructor)(config, implementations) | Constructs a new instance of the StateMachine class |
Properties​
Property | Modifiers | Type | Description |
---|---|---|---|
__TAction | TAction | ||
__TActor | TActor | ||
__TContext | TContext | ||
__TDelay | TDelay | ||
__TEvent | TEvent | ||
__TGuard | TGuard | ||
__TInput | TInput | ||
__TOutput | TOutput | ||
__TResolvedTypesMeta | TResolvedTypesMeta | ||
__TTag | TTag | ||
__xstatenode | true | ||
config | MachineConfig<TContext, TEvent, any, any, any, any, any, any, TOutput, any> | The raw config used to create the machine. | |
definition | readonly | StateMachineDefinition<TContext, TEvent> | |
events | Array<TEvent['type']> | ||
id | string | ||
idMap | Map<string, StateNode<TContext, TEvent>> | ||
implementations | MachineImplementationsSimplified<TContext, TEvent> | ||
root | StateNode<TContext, TEvent> | ||
states | StateNode<TContext, TEvent>['states'] | ||
types | MachineTypes<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TInput, TOutput, TResolvedTypesMeta> | ||
version? | string | (Optional) The machine's own version. |
Methods​
Method | Modifiers | Description |
---|---|---|
createState(stateConfig) | ||
getInitialState(actorCtx, input) | Returns the initial State instance, with reference to self as an ActorRef . | |
getPersistedState(state) | ||
getStateNodeById(stateId) | ||
getTransitionData(state, event) | ||
microstep(state, event, actorCtx) | Determines the next state given the current state and event . Calculates a microstep. | |
provide(implementations) | Clones this state machine with the provided implementations and merges the context (if provided). | |
resolveState(state) | Resolves the given This ensures that | |
resolveStateValue(stateValue, [context]) | ||
restoreState(snapshot, _actorCtx) | ||
start(state) | ||
toJSON() | ||
transition(state, event, actorCtx) | Determines the next state given the current state and received event . Calculates a full macrostep from all microsteps. |