Deprecated

Use EventEmitter will be removed in v0.29.0

Type Parameters

  • T = any

Hierarchy

  • EventDispatcher

Implements

Constructors

Methods

Constructors

Methods

  • Clears any existing handlers or wired event dispatchers on this event dispatcher

    Returns void

  • Unsubscribe an event handler(s) from an event. If a specific handler is specified for an event, only that handler will be unsubscribed. Otherwise all handlers will be unsubscribed for that event.

    Parameters

    • eventName: string

      The name of the event to unsubscribe

    • Optional handler: ((event: Events.GameEvent<T, T>) => void)

      Optionally the specific handler to unsubscribe

    Returns void

  • Subscribe an event handler to a particular event name, multiple handlers per event name are allowed.

    Parameters

    • eventName: string

      The name of the event to subscribe to

    • handler: ((event: Events.GameEvent<T, T>) => void)

      The handler callback to fire on this event

    Returns void

  • Once listens to an event one time, then unsubscribes from that event

    Parameters

    • eventName: string

      The name of the event to subscribe to once

    • handler: ((event: Events.GameEvent<T, T>) => void)

      The handler of the event that will be auto unsubscribed

    Returns void