EventManager handles event emission, listener registration, and event processing. It supports both specific event listeners and global listeners that handle all events. Listeners are processed in order based on their priority.

Constructors

Accessors

Methods

  • Registers a global event listener that handles all events. Global listeners are mixed with specific listeners and ordered by priority.

    Parameters

    Returns void

  • Registers an event listener for specific event(s). Listeners are ordered by priority and executed in ascending order.

    Type Parameters

    • T

    Parameters

    Returns void

  • Emits an event to all registered listeners for that event type. Listeners are processed in order of priority and can stop event propagation.

    Type Parameters

    • TInput

    Parameters

    • eventDefinition: IEvent<TInput>

      The event definition to emit

    • data: TInput

      The event payload data

    • source: string

      The source identifier of the event emitter

    Returns Promise<void>

  • Executes a hook with all registered hook interceptors applied This method should be used by TaskRunner when executing hooks

    Parameters

    Returns Promise<any>

    Promise resolving to the hook execution result

  • Checks if there are any listeners registered for the given event

    Type Parameters

    • T

    Parameters

    • eventDefinition: IEvent<T>

      The event definition to check

    Returns boolean

    true if listeners exist, false otherwise

  • Adds an interceptor for all event emissions Interceptors are executed in the order they are added, with the ability to modify, log, or prevent event emissions

    Parameters

    Returns void

  • Adds an interceptor for hook execution Interceptors are executed in the order they are added, with the ability to modify, log, or prevent hook execution

    Parameters

    Returns void