Class EventHandler

Class EventHandler to manage event subscriptions and dispatching.

Constructors

Methods

  • Dispatches an event to all subscribed callbacks.

    Parameters

    • event: string

      The event name to dispatch.

    • Rest...data: any[]

      Data to be passed to the callback function.

    Returns Promise<any[]>

    A promise resolved with an array of callback responses.

  • Subscribes to an event or a pattern of events.

    Parameters

    • eventString: string

      The event name or pattern to subscribe to.

    • callback: EventCallback

      The callback function to execute when the event is dispatched.

    • id: string

      An identifier for the subscription, used for unsubscribing.

    Returns void

  • Unsubscribes from an event or pattern of events.

    Parameters

    • eventString: string

      The event name or pattern to unsubscribe from.

    • id: string

      The identifier of the subscription to remove.

    Returns void