Skip to main content

TypedEventEmitter <Events>

Implemented by

Index

Methods

emit

  • emit<E>(event: E, ...args: Parameters<Events[E]>): boolean
  • Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • rest...args: Parameters<Events[E]>

    Returns boolean

eventNames

  • eventNames(): (string | symbol | keyof Events)[]
  • Returns (string | symbol | keyof Events)[]

listenerCount

  • listenerCount<E>(event: E): number
  • Type parameters

    • E: string | number | symbol

    Parameters

    • event: E

    Returns number

listeners

  • listeners<E>(event: E): Events[E][]
  • Type parameters

    • E: string | number | symbol

    Parameters

    • event: E

    Returns Events[E][]

off

  • off<E>(event: E, listener: Events[E]): this
  • Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • listener: Events[E]

    Returns this

on

  • on<E>(event: E, listener: Events[E]): this
  • Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • listener: Events[E]

    Returns this

once

  • once<E>(event: E, listener: Events[E]): Events[E]
  • Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • listener: Events[E]

    Returns Events[E]

removeAllListeners

  • removeAllListeners<E>(event?: E): this
  • Type parameters

    • E: string | number | symbol

    Parameters

    • optionalevent: E

    Returns this