Skip to content

TransitionEvent

Defined in: state-machine.ts:67

TransitionEvent describes a transition (change) event in a state machine. See StateMachine Includes the event type, parameters, source and target states, and a reference to the machine.

See also:

This interface is used throughout Matchina to represent events that trigger state transitions. It provides a consistent structure for event handling, allowing for type-safe interactions with state machines. It is a core part of the Matchina API, enabling developers to define and manage state

export interface TransitionEvent<To = unknown, From = To> {
type: string; // The event type string
params: any[]; // Parameters passed to the event
to: To; // Target state for the transition
from: From; // Source state for the transition
get machine(): StateMachine<TransitionEvent<To, From>>; // Reference to the state machine instance
}
Type ParameterDefault typeDescription
TounknownTarget state type
FromToSource state type

get machine(): StateMachine<TransitionEvent<To, From>>

Defined in: state-machine.ts:72

StateMachine<TransitionEvent<To, From>>

Reference to the state machine instance handling this event.

PropertyTypeDescription
typestringThe event type string.
paramsany[]Parameters passed to the event, forwarded through the lifecycle.
toToThe target state for the transition.
fromFromThe source state for the transition.