UNPKG

@launchmenu/core

Version:

An environment for visual keyboard controlled applets

48 lines 1.97 kB
import { ICommand } from "../_types/ICommand"; import { ICommandMetadata } from "../_types/ICommandMetadata"; import { DataCacher, IDataHook } from "model-react"; import { ICommandState } from "../_types/ICommandState"; import { ICompoundCommand } from "../_types/ICompoundCommand"; /** A standard command that can be used to combine commands to execute and undo them together */ export declare class CompoundCommand implements ICompoundCommand { readonly commands: ICommand[]; metadata: ICommandMetadata; /** * Creates a new compound command * @param metadata The meta data of the command * @param commands The commands to combine */ constructor(metadata: ICommandMetadata, commands: ICommand[]); /** * Creates a new compound command, inherits the metadata from the first provided command * @param commands The commands to combine */ constructor(commands: ICommand[]); /** * Retrieves a new compound command that's equivalent to this command with the specified command added * @param command The command to add * @returns The new compound command */ augment(command: ICommand): CompoundCommand; /** * Executes the compound command * @returns A promise that resolves once all subcommands finished executing */ execute(): Promise<void>; /** * Reverts the compound command * @returns A promise that resolves once all subcommands finished executing */ revert(): Promise<void>; protected stateGetter: DataCacher<{ overall: ICommandState; commands: ICommandState[]; }>; /** * Retrieves the state of the compound command. Combining the data of the child commands. * @param hook The hook to subscribe to changes * @returns The state of this command */ getState(hook?: IDataHook): ICommandState; } //# sourceMappingURL=CompoundCommand.d.ts.map