import { Guard } from "../guards.js"; import { Action, ActionArgs, ActionFunction, AnyActorRef, AnyEventObject, EventObject, MachineContext, ParameterizedObject, ProvidedActor, UnifiedArg } from "../types.js"; import { assign } from "./assign.js"; import { cancel } from "./cancel.js"; import { emit } from "./emit.js"; import { raise } from "./raise.js"; import { sendParent, sendTo } from "./send.js"; import { spawnChild } from "./spawnChild.js"; import { stopChild } from "./stopChild.js"; interface ActionEnqueuer { (action: Action): void; assign: (...args: Parameters>) => void; cancel: (...args: Parameters>) => void; raise: (...args: Parameters>) => void; sendTo: (...args: Parameters>) => void; sendParent: (...args: Parameters>) => void; spawnChild: (...args: Parameters>) => void; stopChild: (...args: Parameters>) => void; emit: (...args: Parameters>) => void; } export interface EnqueueActionsAction { (args: ActionArgs, params: TParams): void; _out_TEvent?: TEvent; _out_TActor?: TActor; _out_TAction?: TAction; _out_TGuard?: TGuard; _out_TDelay?: TDelay; } interface CollectActionsArg extends UnifiedArg { check: (guard: Guard) => boolean; enqueue: ActionEnqueuer; } type CollectActions = ({ context, event, check, enqueue, self }: CollectActionsArg, params: TParams) => void; /** * Creates an action object that will execute actions that are queued by the * `enqueue(action)` function. * * @example * * ```ts * import { createMachine, enqueueActions } from 'xstate'; * * const machine = createMachine({ * entry: enqueueActions(({ enqueue, check }) => { * enqueue.assign({ count: 0 }); * * if (check('someGuard')) { * enqueue.assign({ count: 1 }); * } * * enqueue('someAction'); * }) * }); * ``` */ export declare function enqueueActions(collect: CollectActions): ActionFunction; export {};