Skip to main content
Version: Current

ActionHandler

@rotorsoft/act-root


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

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

ActionHandler<TState, TEvents, TActions, TKey, TLoaded, TRouted> = (action, snapshot, target, loaded) => Emitted<TEvents & TRouted> | readonly Emitted<TEvents & TRouted>[] | undefined

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

Handles an action, producing the events to emit, or undefined (or []) to commit nothing.

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.

TLoaded​

TLoaded extends Record<string, Schema | undefined> = { }

TRouted​

TRouted extends Schemas = { }

Parameters​

action​

Readonly<TActions[TKey]>

snapshot​

Readonly<Snapshot<TState, TEvents>>

target​

Target

loaded​

Readonly<TLoaded>

Returns​

Emitted<TEvents & TRouted> | readonly Emitted<TEvents & TRouted>[] | undefined