@chromia/ft4 - v2.1.0
    Preparing search index...

    Class EventEmitter<T>

    Class that can handle event dispatching. Users can register event handlers for certain events and when the emit() function is called, this class will take care of invoking all of the event handlers that were registered for events of that type.

    Type Parameters

    • T extends Record<string, any[]>

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Constructors

    • Type Parameters

      • T extends Record<string, any[]>

      Returns EventEmitter<T>

    Methods

    • Fires the event, calling all registered listeners with the provided arguments.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • event: K

        The event name.

      • ...args: T[K]

        The arguments for the listeners.

      Returns void

    • Removes a listener for the event.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • event: K

        The event name.

      • listener: Listener<T[K]>

        The listener callback.

      Returns void

    • Registers a new listener for the event.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • event: K

        The event name.

      • listener: Listener<T[K]>

        The listener callback.

      Returns () => void

      A function that removes the listener when called.