Skip to content
Version: xstate@5.0.0

Actor class​

Signature:

export declare class Actor<TLogic extends AnyActorLogic> implements ActorRef<EventFromLogic<TLogic>, SnapshotFrom<TLogic>> 

Implements: ActorRef<EventFromLogic<TLogic>, SnapshotFrom<TLogic>>

Constructors​

ConstructorModifiersDescription
(constructor)(logic, options)Creates a new actor instance for the given logic with the provided options, if any.

Properties​

PropertyModifiersTypeDescription
_parent?ActorRef<any, any>(Optional)
clockClockThe clock that is responsible for setting and clearing timeouts, such as delayed events and transitions.
idstringThe unique identifier for this actor relative to its parent.
logicTLogic
optionsReadonly<ActorOptions<TLogic>>
refActorRef<EventFromLogic<TLogic>, SnapshotFrom<TLogic>>
sessionIdstringThe globally unique process ID for this invocation.
src?string(Optional)
statusActorStatusWhether the service is started.
systemActorSystem<any>

Methods​

MethodModifiersDescription
[symbolObservable]()
cancel(sendId)
delaySend(params)
getPersistedState()
getSnapshot()
send(event)Sends an event to the running Actor to trigger a transition.
start()Starts the Actor from the initial state
stop()Stops the Actor and unsubscribe all listeners.
subscribe(observer)
subscribe(nextListener, errorListener, completeListener)
toJSON()