Skip to main content

ActionHandler

@rotorsoft/act-root


@rotorsoft/act-root / act/src / ActionHandler

Type Alias: ActionHandler<TState, TEvents, TActions, TKey>

ActionHandler<TState, TEvents, TActions, TKey> = (action, snapshot, target) => Emitted<TEvents> | Emitted<TEvents>[] | undefined

Defined in: libs/act/src/types/action.ts:392

Handles an action, producing one or more emitted events.

Type Parametersโ€‹

TStateโ€‹

TState extends Schema

State schema.

TEventsโ€‹

TEvents extends Schemas

Event schemas.

TActionsโ€‹

TActions extends Schemas

Action schemas.

TKeyโ€‹

TKey extends keyof TActions

Action name.

Parametersโ€‹

actionโ€‹

Readonly<TActions[TKey]>

snapshotโ€‹

Readonly<Snapshot<TState, TEvents>>

targetโ€‹

Target

Returnsโ€‹

Emitted<TEvents> | Emitted<TEvents>[] | undefined