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

x/xstate/src/StateMachine.ts>StateMachine

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

Constructors

new
StateMachine(config: MachineConfig<TContext, TEvent, any, any, any>, options?: MachineImplementationsSimplified<TContext, TEvent>)

Type Parameters

TContext extends MachineContext
optional
TEvent extends EventObject = EventObject
optional
TAction extends ParameterizedObject = ParameterizedObject
optional
TActorMap extends ActorMap = ActorMap

Properties

deprecated
__TAction: TAction
deprecated
__TActorMap: TActorMap
deprecated
__TContext: TContext
deprecated
__TEvent: TEvent
deprecated
__TResolvedTypesMeta: TResolvedTypesMeta
__xstatenode: true
readonly
definition: StateMachineDefinition<TContext, TEvent>
delimiter: string

The string delimiter for serializing the path to a string. The default is "."

events: Array<TEvent["type"]>
id: string
idMap: Map<string, StateNode<TContext, TEvent>>
readonly
initialState: State<TContext, TEvent, TResolvedTypesMeta>

The initial State instance, which includes all actions to be executed from entering the initial state.

states: StateNode<TContext, TEvent>["states"]
optional
version: string

The machine's own version.

Methods

private
getContextAndActions(actorCtx?: ActorContext<any, any>, input?: any): [TContext, InvokeActionObject[]]
private
getPreInitialState(actorCtx: AnyActorContext | undefined, input: any): State<TContext, TEvent, TResolvedTypesMeta>

The initial state before evaluating any microsteps. This "pre-initial" state is provided to initial actions executed in the initial state.

getContext(input?: any): TContext

Returns the initial State instance, with reference to self as an ActorRef.

Determines the next state given the current state and event. Calculates a microstep.

Clones this state machine with the provided implementations and merges the context (if provided).

Resolves the given state to a new State instance relative to this machine.

This ensures that .nextEvents represent the correct values.

Determines the next state given the current state and received event. Calculates a full macrostep from all microsteps.