UNPKG

1.27 kBTypeScriptView Raw
1import { IAnyStateTreeNode, IMiddlewareEvent } from "../internal";
2export interface IActionContext {
3 /** Event name (action name for actions) */
4 readonly name: string;
5 /** Event unique id */
6 readonly id: number;
7 /** Parent action event object */
8 readonly parentActionEvent: IMiddlewareEvent | undefined;
9 /** Event context (node where the action was invoked) */
10 readonly context: IAnyStateTreeNode;
11 /** Event tree (root node of the node where the action was invoked) */
12 readonly tree: IAnyStateTreeNode;
13 /** Event arguments in an array (action arguments for actions) */
14 readonly args: any[];
15}
16/**
17 * Returns the currently executing MST action context, or undefined if none.
18 */
19export declare function getRunningActionContext(): IActionContext | undefined;
20/**
21 * Returns if the given action context is a parent of this action context.
22 */
23export declare function isActionContextChildOf(actionContext: IActionContext, parent: number | IActionContext | IMiddlewareEvent): boolean;
24/**
25 * Returns if the given action context is this or a parent of this action context.
26 */
27export declare function isActionContextThisOrChildOf(actionContext: IActionContext, parentOrThis: number | IActionContext | IMiddlewareEvent): boolean;