Since

2.0.0

Type Parameters

  • E extends Record<string, any>

Hierarchy (view full)

Constructors

Methods

  • Alias for emitter.on(eventName, listener).

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N
    • listener: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns this

    Since

    2.0.0

  • Returns the number of listeners listening to the event named eventName.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N

    Returns number

    Since

    2.0.0

  • Removes the all specified listener from the listener array for the event eventName Returns a reference to the EventEmitter, so that calls can be chained.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N
    • listener: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns this

    Since

    2.0.0

  • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

    Returns a reference to the EventEmitter, so that calls can be chained.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N
    • listener: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns this

    Since

    2.0.0

  • Adds a one-timelistener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

    Returns a reference to the EventEmitter, so that calls can be chained.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N
    • listener: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns this

    Since

    2.0.0

  • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

    Returns a reference to the EventEmitter, so that calls can be chained.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N
    • listener: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns this

    Since

    2.0.0

  • Adds a one-timelistener function for the event named eventName to the_beginning_ of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

    Returns a reference to the EventEmitter, so that calls can be chained.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N
    • listener: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns this

    Since

    2.0.0

  • Removes all listeners, or those of the specified eventName.

    Returns a reference to the EventEmitter, so that calls can be chained.

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • Optional event: N

    Returns this

    Since

    2.0.0

  • Alias for emitter.off(eventName, listener).

    Type Parameters

    • N extends string | number | symbol

    Parameters

    • eventName: N
    • listener: ((arg) => void)
        • (arg): void
        • Parameters

          Returns void

    Returns this

    Since

    2.0.0