Function: eventMatches()
Documentation / @xmachines/play-xstate / eventMatches
function eventMatches<TEvent>(eventType): Guard<unknown, TEvent>;Defined in: packages/play-xstate/src/guards/helpers.ts:49
Check if event type matches expected type
Type Parameters
| Type Parameter | Default type |
|---|---|
TEvent extends PlayEvent | PlayEvent |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventType | string | Expected event type |
Returns
Guard<unknown, TEvent>
Guard predicate checking event type
Example
const machine = setup({ guards: { isSubmitEvent: eventMatches("submit"), isBackOrForward: composeGuardsOr([eventMatches("back"), eventMatches("forward")]), },});