Skip to main content

EventEmitter <TEventMap>

Excalibur's typed event emitter, this allows events to be sent with any string to Type mapping

Index

Constructors

constructor

Methods

clear

  • clear(): void
  • Removes all listeners and pipes


    Returns void

emit

  • emit<TEventName>(eventName: TEventName, event: TEventMap[TEventName]): void
  • emit(eventName: string, event?: any): void
  • Type parameters

    • TEventName: string

    Parameters

    • eventName: TEventName
    • event: TEventMap[TEventName]

    Returns void

off

  • off<TEventName>(eventName: TEventName, handler: Handler<TEventMap[TEventName]>): void
  • off(eventName: string, handler: Handler<unknown>): void
  • off(eventName: string): void
  • Type parameters

    • TEventName: string

    Parameters

    • eventName: TEventName
    • handler: Handler<TEventMap[TEventName]>

    Returns void

on

  • Type parameters

    • TEventName: string

    Parameters

    • eventName: TEventName
    • handler: Handler<TEventMap[TEventName]>

    Returns Subscription

once

  • Type parameters

    • TEventName: string

    Parameters

    • eventName: TEventName
    • handler: Handler<TEventMap[TEventName]>

    Returns Subscription

pause

  • pause(): void
  • Paused event emitters do not emit events


    Returns void

pipe

unpause

  • unpause(): void
  • Unpaused event emitter do emit events


    Returns void

unpipe

  • Remove any piped emitters


    Parameters

    Returns void