@barchart/common-js
Version:
Library of common JavaScript utilities
47 lines (46 loc) • 1.06 kB
TypeScript
/**
* An object that can perform an action.
*
* @public
*/
export default class CommandHandler {
/**
* Returns a function which executes the command.
*
* @public
* @static
* @param {CommandHandler} commandHandler
* @returns {Function}
*/
public static toFunction(commandHandler: CommandHandler): Function;
/**
* Returns a {@link CommandHandler} that delegates execution to a function.
*
* @public
* @static
* @param {Function} handler - The function which the command delegates to.
* @returns {CommandHandler}
*/
public static fromFunction(handler: Function): CommandHandler;
/**
* Execute the action.
*
* @public
* @param {*} data
* @returns {*}
*/
public process(data: any): any;
/**
* @protected
* @param {*} data
* @returns {*}
*/
protected _process(data: any): any;
/**
* Returns a string representation.
*
* @public
* @returns {string}
*/
public toString(): string;
}