Navigation
These archived docs are for Phaser 2.4.7 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

PIXI. EventTarget

new EventTarget()

Mixins event emitter functionality to a class

Source code: pixi/utils/EventTarget.js (Line 11)

Public Methods

emit(eventName) → {Boolean}

Emit an event to all registered event listeners.

Parameters
Name Type Description
eventName String

The name of the event.

Returns
Boolean -

Indication if we've emitted an event.

Source code: pixi/utils/EventTarget.js (Line 54)

listeners(eventName) → {Array}

Return a list of assigned event listeners.

Parameters
Name Type Description
eventName String

The events that should be listed.

Returns
Array -

An array of listener functions

Source code: pixi/utils/EventTarget.js (Line 41)

mixin(object)

Mixes in the properties of the EventTarget prototype onto another object

Parameters
Name Type Description
object Object

The obj to mix into

Source code: pixi/utils/EventTarget.js (Line 34)

off(eventName, callback)

Remove event listeners.

Parameters
Name Type Description
eventName String

The event we want to remove.

callback function

The listener that we need to find.

Source code: pixi/utils/EventTarget.js (Line 143)

on(eventName, callback)

Register a new EventListener for the given event.

Parameters
Name Type Description
eventName String

Name of the event.

callback Functon

fn Callback function.

Source code: pixi/utils/EventTarget.js (Line 107)

once(eventName, callback)

Add an EventListener that's only called once.

Parameters
Name Type Description
eventName String

Name of the event.

callback function

Callback function.

Source code: pixi/utils/EventTarget.js (Line 124)

removeAllListeners(eventName)

Remove all listeners or only the listeners for the specified event.

Parameters
Name Type Description
eventName String

The event you want to remove all listeners for.

Source code: pixi/utils/EventTarget.js (Line 173)