Interface ICommandHook<STATE, CONTEXT>

A hook that can be passed to a command execute function.

interface ICommandHook<STATE, CONTEXT> {
    beforeExecute?(command, args): boolean | void | Promise<boolean | void>;
    onError?(command, error, args): void;
    onExecute?(command, args): void;
}

Type Parameters

  • STATE extends any
  • CONTEXT extends any = void

Methods

  • If implemented this will be called when execute is called. If a promise is return if will wait until this is completed.

    Parameters

    Returns boolean | void | Promise<boolean | void>

  • Called when a command failed to executed successfully

    Parameters

    Returns void

  • Called when a command has been executed successful

    Parameters

    Returns void