C
AsyncStateMachine
v0.0.8testedAsync finite state machine with support for async guards, actions, and hooks
Signature
ts
class AsyncStateMachine<States extends string = string, Events extends string = string, Context = undefined> extends BaseStateMachine<States, Events, Context, AsyncStateNodeConfig<Context>>Type Parameters
Statesextends string= stringEventsextends string= stringContext= undefinedMethods
sendSend an event to the machine, awaiting async guards, actions, and hooks
ts
async send(event: Events): Promise<States>| Parameter | Type | Description |
|---|---|---|
event | Events | Event name |
Returns
Promise<States>The current state after processing the eventcanCheck if an event can trigger a transition, awaiting async guards
ts
async can(event: Events): Promise<boolean>| Parameter | Type | Description |
|---|---|---|
event | Events | Event to check |
Returns
Promise<boolean>