C
StateMachine
v0.0.8testedSimple, performant, and type-safe finite state machine
Signature
ts
class StateMachine<States extends string = string, Events extends string = string, Context = undefined> extends BaseStateMachine<States, Events, Context, SyncStateNodeConfig<Context>>Type Parameters
Statesextends string= stringEventsextends string= stringContext= undefinedMethods
sendSend an event to the machine, potentially causing a state transition
ts
send(event: Events): States| Parameter | Type | Description |
|---|---|---|
event | Events | Event name |
Returns
StatesThe current state after processing the eventcanCheck if an event can trigger a transition from the current state
ts
can(event: Events): boolean| Parameter | Type | Description |
|---|---|---|
event | Events | Event to check |
Returns
boolean