@samatawy/rules
    Preparing search index...

    Class CommandHandler

    The CommandHandler is responsible for managing the execution of command actions, both immediate and deferred. One handler should be created for each context, using the commands registered in the CommandRegistry.

    Implements

    Index

    Constructors

    Properties

    immediateMap: Map<string, ICommandAction> = ...
    deferredMap: Map<string, ICommandAction> = ...
    workingMap: Map<string, ICommandAction> = ...
    completedMap: Map<string, ICommandAction> = ...

    Methods

    • Add an action to the handler. Each action must have a unique hash that identifies it. If an action with the same hash is already registered, an error will be thrown. If the action is marked as immediate, it will be executed immediately using the associated plugin. If the action is deferred, it will be stored for later execution when executeDeferred() is called.

      Parameters

      Returns any

      the result of the action if it is immediate, or true if it is deferred.

      an error if an action with the same hash is already registered.

    • Execute all deferred actions that have been added to the handler. This should be called after processing rules to ensure that all deferred command actions are executed.

      Returns Promise<any>

      A promise that resolves when all deferred actions have been executed.