@launchmenu/core
Version:
An environment for visual keyboard controlled applets
38 lines • 2.34 kB
TypeScript
import { IDataHook } from "model-react";
import { IAction } from "../_types/IAction";
import { IActionBinding } from "../_types/IActionBinding";
import { IActionNode } from "../_types/IActionNode";
import { IActionResult } from "../_types/IActionResult";
import { IActionTarget } from "../_types/IActionTarget";
import { IIndexedActionBinding } from "../_types/IIndexedActionBinding";
/**
* Obtains the result of the last action node, when all actions are reduced from left to right
* @param actions The actions and their bindings to reduce to a single result
* @param items The input items that actions can use to extract extra data
* @param hook The hook to subscribe to changes (when action bindings change their data)
* @param getActionResultIndex The function to use to decide how to order action handler bindings with other bindings
* @returns The result of the final action
*/
export declare function reduceActions(actions: IActionNode[], items: IActionTarget[], hook?: IDataHook, getActionResultIndex?: (bindings: IIndexedActionBinding[]) => number): IActionResult<any, any> | undefined;
/**
* Retrieves the action bindings given action, combining direct bindings and handler result bindings in the correct order
* @param actionNode The node to get the action inputs for
* @returns The inputs for the action of the given node
*/
export declare function getAllActionBindings(actionNode: IActionNode): IIndexedActionBinding[];
/**
* Retrieves the binding data for a given action binding
* @param binding The binding to retrieve the data of
* @param hook The data hook to subscribe to changes
* @returns The binding data
*/
export declare function getBindingData<A extends IAction<I, any, any>, I>(binding: IActionBinding<A>, hook?: IDataHook): I;
/**
* Adds appropriate indexing data to all child bindings of this result
* @param actionResult The action result to add indexing to
* @param indices The indices of the inputs of this action
* @param combinedIndices The combined indices of the input
* @returns The indexed result
*/
export declare function getIndexedResult<B extends IAction, O>(actionResult: IActionResult<IActionBinding<B>, O>, indices: number[], combinedIndices: number): IActionResult<IIndexedActionBinding<B>, O>;
//# sourceMappingURL=reduceActions.d.ts.map