Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Eventable

Implemented by

Index

Methods

  • Emits an event for target

    Parameters

    • eventName: string

      The name of the event to publish

    • event: Events.GameEvent<any, any>

      Optionally pass an event data object to the handler

    Returns void

  • off(eventName: string, handler?: (event: Events.GameEvent<any, any>) => void): 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<any, any>) => void

      Optionally the specific handler to unsubscribe

    Returns void

  • on(eventName: string, handler: (event: Events.GameEvent<any, any>) => void): 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<any, any>) => void

      The handler callback to fire on this event

    Returns void

  • once(eventName: string, handler: (event: Events.GameEvent<any, any>) => void): void
  • Once listens to an event once then auto unsubscribes from that event

    Parameters

    • eventName: string

      The name of the event to subscribe to once

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

      The handler of the event that will be auto unsubscribed

    Returns void