Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Eventable

Hierarchy

  • Eventable

Implemented by

Index

Methods

Methods

emit

  • emit(eventName: string, event: GameEvent<any>): void
  • Emits an event for target

    Parameters

    • eventName: string

      The name of the event to publish

    • event: GameEvent<any>

      Optionally pass an event data object to the handler

    Returns void

off

  • off(eventName: string, handler?: function): 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: function

      Optionally the specific handler to unsubscribe

    Returns void

on

  • on(eventName: string, handler: function): 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: function

      The handler callback to fire on this event

    Returns void

once

  • once(eventName: string, handler: function): 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: function

      The handler of the event that will be auto unsubscribed

    Returns void