PokéRogue
    Preparing search index...

    Class EventBus

    Extension of Phaser.Events.EventEmitter with custom event names

    Hierarchy (View Summary)

    Index
    • Removes all listeners from this EventEmitter and prepares it for garbage collection. This method is called automatically when the parent object is destroyed and should not be called directly unless you are tearing down the emitter manually.

      Returns void

    • Calls each of the listeners registered for a given event.

      Parameters

      • event: AnyEvent

        The event name.

      • ...args: any[]

        Additional arguments that will be passed to the event handler.

      Returns boolean

      true if the event had listeners, else false.

    • Return an array listing the events for which the emitter has registered listeners.undefined

      Returns (string | symbol)[]

      undefined

    • Return the number of listeners listening to a given event.

      Parameters

      • event: string | symbol

        The event name.

      Returns number

      The number of listeners.

    • Return the listeners registered for a given event.

      Parameters

      • event: string | symbol

        The event name.

      Returns Function[]

      The registered listeners.

    • Remove the listeners of a given event.

      Type Parameters

      • D = any
      • C = any

      Parameters

      • event: AnyEvent

        The event name.

      • Optionalfn: EventCallbackFn<D>

        Only remove the listeners that match this function.

      • Optionalcontext: C

        Only remove the listeners that have this context.

      • Optionalonce: boolean

        Only remove one-time listeners.

      Returns this

      this.

    • Add a one-time listener for a given event. The listener is automatically removed the first time the event is emitted, so it will never be called more than once.

      Type Parameters

      • D = any
      • C = any

      Parameters

      • event: AnyEvent

        The event name.

      • fn: EventCallbackFn<D>

        The listener function.

      • Optionalcontext: C

        The context to invoke the listener with. Default this.

      Returns this

      this.

    • Remove the listeners of a given event.

      Type Parameters

      • D = any
      • C = any

      Parameters

      • event: AnyEvent

        The event name.

      • Optionalfn: EventCallbackFn<D>

        Only remove the listeners that match this function.

      • Optionalcontext: C

        Only remove the listeners that have this context.

      • Optionalonce: boolean

        Only remove one-time listeners.

      Returns this

      this.

    • Removes all listeners from this EventEmitter. This method is called automatically by the Scene Systems when the parent Scene shuts down, ensuring that all event bindings are cleared and no stale references remain.

      Returns void