Dispatcher
@rotorsoft/act-root / act/src / Dispatcher
Interface: Dispatcher<TActions, TActor>
Defined in: libs/act/src/types/action.ts:405
Typed interface for the app.do() method, enabling reaction handlers
to dispatch actions with full autocomplete.
Construct with InferActions to avoid circular imports between slice files and the bootstrap module.
Example
import type { Dispatcher, InferActions } from "@rotorsoft/act";
type App = Dispatcher<
InferActions<typeof StateA> &
InferActions<typeof StateB>
>;
async function myReaction(event: ..., stream: string, app: App) {
await app.do("someAction", target, payload, event);
}
Type Parameters
TActions
TActions extends Schemas
Action schemas (maps action names to payload types)
TActor
Actor type extending base Actor
Methods
do()
do<
TKey>(action,target,payload,reactingTo?,skipValidation?):Promise<Snapshot<any,any>[]>
Defined in: libs/act/src/types/action.ts:409
Type Parameters
TKey
TKey extends string
Parameters
action
TKey
target
Target<TActor>
payload
Readonly<TActions[TKey]>
reactingTo?
skipValidation?
boolean
Returns
Promise<Snapshot<any, any>[]>