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
  • 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
  • Returns void

pipe

unpause

  • unpause(): void
  • Returns void

unpipe