Service for handling application level events

Hierarchy

  • EventDispatcher

Methods

  • Add a new listener for a specific event

    Type Parameters

    • T

    Parameters

    • eventName: string

      name of the event to listen to

    • listener: ((event: CustomEvent<T>) => void)

      listener to invoke when the event is dispatched

        • (event: CustomEvent<T>): void
        • Parameters

          • event: CustomEvent<T>

          Returns void

    Returns void

  • Dispatch a new event

    Type Parameters

    • T

    Parameters

    • eventName: string

      name of the event to dispatch

    • data: T

      data attached to the event

    Returns CustomEvent<T>

  • Stop listening for a specific event

    Type Parameters

    • T

    Parameters

    • eventName: string

      name of the event to stop listening to

    • listener: ((event: CustomEvent<T>) => void)

      listener to remove from the dispatcher

        • (event: CustomEvent<T>): void
        • Parameters

          • event: CustomEvent<T>

          Returns void

    Returns void