Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventMixin

Wrapper class for event handling.

Hierarchy

Index

Methods

addEventListener

  • addEventListener(type: string, callback: function): void
  • Adds an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: function

      Listener callback function.

        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

emitEvent

  • emitEvent<T>(event: T): void
  • Emits a player event.

    Type parameters

    Parameters

    • event: T

      Event that contains at least a 'type' property.

    Returns void

off

  • off(type: string, callback: function): void
  • Alias method for removeEventListener.

    Parameters

    • type: string

      Event type.

    • callback: function

      Listener callback function.

        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

on

  • on(type: string, callback: function): void
  • Alias method for addEventListener.

    Parameters

    • type: string

      Event type.

    • callback: function

      Listener callback function.

        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

removeAllListeners

  • removeAllListeners(): void
  • Removes all listeners.

    Returns void

removeEventListener

  • removeEventListener(type: string, callback: function): void
  • Removes an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: function

      Listener callback function.

        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void