UNPKG

1.26 kBTypeScriptView Raw
1import { ActionArgs, ActionFunction, DoNotInfer, EventObject, MachineContext, ParameterizedObject, RaiseActionOptions, SendExpr } from "../types.js";
2export interface RaiseAction<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject, TDelay extends string> {
3 (args: ActionArgs<TContext, TExpressionEvent, TEvent>, params: TParams): void;
4 _out_TEvent?: TEvent;
5 _out_TDelay?: TDelay;
6}
7/**
8 * Raises an event. This places the event in the internal event queue, so that
9 * the event is immediately consumed by the machine in the current step.
10 *
11 * @param eventType The event to raise.
12 */
13export declare function raise<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TDelay extends string = never, TUsedDelay extends TDelay = never>(eventOrExpr: DoNotInfer<TEvent> | SendExpr<TContext, TExpressionEvent, TParams, DoNotInfer<TEvent>, TEvent>, options?: RaiseActionOptions<TContext, TExpressionEvent, TParams, DoNotInfer<TEvent>, TUsedDelay>): ActionFunction<TContext, TExpressionEvent, TEvent, TParams, never, never, never, TDelay, never>;