@gud/cli
    Preparing search index...

    Class HookRegistry<THooks>

    A registry for managing and executing hook handlers. Handlers are executed sequentially in registration order.

    const hooks = new HookRegistry<{
    beforeRun: (payload: { command: string }) => void;
    }>();

    hooks.on('beforeRun', ({ command }) => {
    console.log('Running command:', command);
    });

    hooks.call('beforeRun', { command: 'foo bar' }); // -> 'Running command: foo bar'

    Type Parameters

    • THooks extends AnyObject = LifecycleHooks

      An object that maps hook names to their corresponding handler function types. The handler function type should accept a single payload argument.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Call all handlers registered for a hook. Handlers are called sequentially in registration order.

      Type Parameters

      • THook extends string | number | symbol | string & {}

      Parameters

      Returns Promise<void>

    • Remove a previously registered handler.

      Type Parameters

      • THook extends string | number | symbol | string & {}

      Parameters

      Returns boolean

      A boolean indicating whether the handler was found and removed.