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.19/src/StateMachine.ts";

Constructors

new
StateMachine(config: MachineConfig<TContext, TEvent, any, any, any>, implementations?: 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>
events: Array<TEvent["type"]>
id: string
idMap: Map<string, StateNode<TContext, TEvent>>
states: StateNode<TContext, TEvent>["states"]
optional
version: string

The machine's own version.

Methods

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

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.