A type-safe event emitter.

Type Parameters

  • E

    The interface that maps event names and event objects.

Hierarchy

  • Emitter

Constructors

Methods

Constructors

Methods

  • Type Parameters

    • EventName extends string | number | symbol

    Parameters

    • eventName: EventName
    • event: E[EventName]

    Returns void

  • Removes an event listener from the emitter.

    Type Parameters

    • EventName extends string | number | symbol

    Parameters

    • eventName: EventName

      The event name.

    • handler: Handler<E[EventName]>

      The event handler to remove.

    Returns Emitter<E>

  • Adds an event listener to the emitter.

    Type Parameters

    • EventName extends string | number | symbol

    Parameters

    • eventName: EventName

      The event name to listen.

    • handler: Handler<E[EventName]>

      The event handler.

    Returns Emitter<E>

Generated using TypeDoc