Skip to content
Version: xstate@5.0.0

xstate package​

Classes​

ClassDescription
Actor
SimulatedClock
State
StateMachine
StateNode

Enumerations​

EnumerationDescription
ActorStatus
SpecialTargets

Functions​

FunctionDescription
and(guards)
assign(assignment)Updates the current context of the machine.
cancel(sendId)Cancels an in-flight send(...) action. A canceled sent action will not be executed, nor will its event be sent, unless it has already been sent (e.g., if cancel(...) is called after the send(...) action's delay).
choose(branches)
createActor(machine, options)Creates a new ActorRef instance for the given machine with the provided options, if any.
createActor(logic, options)
createEmptyActor()
createMachine(config, implementations)
escalate(errorData, options)Escalates an error by sending it as an event to this machine's parent.
forwardTo(target, options)Forwards (sends) an event to a specified service.
fromCallback(invokeCallback)An actor logic creator which returns callback logic as defined by a callback function.
fromEventObservable(lazyObservable)Creates event observable logic that listens to an observable that delivers event objects.
fromObservable(observableCreator)
fromPromise(promiseCreator)
fromTransition(transition, initialContext)

Returns actor logic from a transition function and its initial state.

A transition function is a function that takes the current state and an event and returns the next state.

getStateNodes(stateNode, state)Returns the state nodes represented by the current state value.
log(value, label)
mapState(stateMap, stateId)
matchesState(parentStateId, childStateId)
not(guard)
or(guards)
pathToStateValue(statePath)
pure(getActions)
raise(eventOrExpr, options)Raises an event. This places the event in the internal event queue, so that the event is immediately consumed by the machine in the current step.
sendParent(event, options)Sends an event to this machine's parent.
sendTo(to, eventOrExpr, options)Sends an event to an actor.
spawn([src, { id, systemId, input, syncSnapshot }])
stateIn(stateValue)
stop_2(actorRef)Stops an actor.
toObserver(nextHandler, errorHandler, completionHandler)
waitFor(actorRef, predicate, options)Subscribes to an actor ref and waits for its emitted value to satisfy a predicate, and then resolves with that value. Will throw if the desired state is not reached after a timeout (defaults to 10 seconds).

Interfaces​

InterfaceDescription
ActionArgs
ActorContext
ActorLike
ActorLogic
ActorOptions
ActorRef
ActorSystem
ActorSystemInfo
AnyEventObject
AssignAction
AssignArgs
AtomicStateNodeConfig
BaseActorRef
CancelAction
ChooseAction
ChooseBranch
DelayedTransitionDefinition
DoneActorEvent
DoneStateEvent
ErrorActorEvent
EventObjectThe full definition of an event, with a string type.
HistoryStateNode
HistoryStateNodeConfig
InitialTransitionConfig
InitialTransitionDefinition
InspectedActorEvent
InspectedEventEvent
InspectedSnapshotEvent
InteropObservable
InteropSubscribable
InvokeDefinition
LogAction
MachineImplementationsSimplified
MachineTypes
MarkAllImplementationsAsProvided
ParameterizedObject
ProvidedActor
PureAction
RaiseAction
RaiseActionOptions
RaiseActionParams
ResolvedTypegenMeta
ResolveTypegenMeta
SendToAction
SendToActionOptions
SendToActionParams
SimulatedClock
SnapshotEvent
SpawnAction
StateConfig
StateLike
StateMachineDefinition
StateNodeConfig
StateNodeDefinition
StateValueMap
StopAction
Subscribable
Subscription
TransitionConfig
TransitionDefinition
TypegenDisabled
TypegenEnabled
TypegenMeta
UnifiedArg

Variables​

VariableDescription
interpretCreates a new Interpreter instance for the given machine with the provided options, if any.
InterpreterStatus

Type Aliases​

Type AliasDescription
__ResolvedTypesMetaFrom
Action
ActionFunction
ActionFunctionMap
Actions
ActorLogicFrom
ActorRefFrom
AnyActor
AnyActorContext
AnyActorLogic
AnyActorRef
AnyActorSystem
AnyFunction
AnyHistoryValue
AnyInterpreter
AnyInvokeConfig
AnyState
AnyStateConfig
AnyStateMachine
AnyStateNode
AnyStateNodeConfig
AnyStateNodeDefinition
AnyTransitionConfig
AnyTransitionDefinition
AreAllImplementationsAssumedToBeProvided
Assigner
CallbackActorLogic
Cast
Compute
ContextFactory
ContextFrom
DelayConfig
DelayedTransitions
DelayExpr
DelayFunctionMap
DevToolsAdapter
Equals
EventDescriptor
EventFrom
EventFromLogic
ExtractEvent
GetParameterizedParams
HistoryValue
HomomorphicOmit
HomomorphicPick
IndexByProp
IndexByType
InferEvent
InputFrom
InspectionEvent
InternalMachineImplementations
Interpreter
InterpreterFrom
InvokeConfig
IsAny
IsLiteralString
IsNever
Lazy
LogExpr
LowInfer
MachineConfig
MachineContext
MachineImplementations
MachineImplementationsFrom
MachineSnapshot
Mapper
MaybeLazy
Merge
MetaObject
MissingImplementationsError
NoInfer
NonReducibleUnknown
NoRequiredParams
ObservableActorLogic
Observer
OutputFrom
PartialAssigner
PromiseActorLogic
Prop
PropertyAssigner
SendExpr
SimpleOrStateNodeConfig
SingleOrArray
Snapshot
SnapshotFrom
Spawner
StateFrom
StateKey
StateNodesConfig
StatesConfig
StatesDefinition
StateTypes
StateValueThe string or object representing the state value relative to the parent state node.
StateValueFrom
TagsFrom
TODO
TransitionActorLogic
TransitionConfigOrTarget
TransitionConfigTarget
TransitionDefinitionMap
Transitions
TransitionsConfig
TransitionSnapshot
TransitionTarget
TypegenConstraint
UnknownAction
Values
WithDynamicParams