Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Class

Excalibur base class that provides basic functionality such as EventDispatcher and extending abilities for vanilla Javascript projects

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

eventDispatcher

eventDispatcher: EventDispatcher

Direct access to the game object event dispatcher.

Methods

emit

  • emit(eventName: string, eventObject: GameEvent<any>): void
  • Emits a new event

    Parameters

    • eventName: string

      Name of the event to emit

    • eventObject: GameEvent<any>

      Data associated with this event

    Returns void

off

  • off(eventName: string, handler?: function): void
  • Alias for removeEventListener. If only the eventName is specified it will remove all handlers registered for that specific event. If the eventName and the handler instance are specified only that handler will be removed.

    Parameters

    • eventName: string

      Name of the event to listen for

    • Optional handler: function

      Event handler for the thrown event

    Returns void

on

  • on(eventName: string, handler: function): void
  • Alias for addEventListener. You can listen for a variety of events off of the engine; see the events section below for a complete list.

    Parameters

    • eventName: string

      Name of the event to listen for

    • handler: function

      Event handler for the thrown event

    Returns void

once

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

      The handler of the event that will be auto unsubscribed

    Returns void