Interface: SceneEventEmitter

Phaser.Types.Scenes. SceneEventEmitter

Extends

Methods


addListener(event, fn [, context])

Add a listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 130)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

addListener(event, fn [, context])

Add a listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 114)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

destroy()

Removes all listeners.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 42)

emit(event [, args])

Calls each of the listeners registered for a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

args * <optional>
<repeatable>

Additional arguments that will be passed to the event handler.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 58)
Returns:

true if the event had listeners, else false.

Type
boolean

emit(event [, args])

Calls each of the listeners registered for a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

args * <optional>
<repeatable>

Additional arguments that will be passed to the event handler.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 73)
Returns:

true if the event had listeners, else false.

Type
boolean

eventNames()

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

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 55)
Returns:
Type
Array.<(string|symbol)>

listenerCount(event)

Return the number of listeners listening to a given event.

Parameters:
Name Type Description
event string | symbol

The event name.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 32)
Returns:

The number of listeners.

Type
number

listenerCount(event)

Return the number of listeners listening to a given event.

Parameters:
Name Type Description
event string | symbol

The event name.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 45)
Returns:

The number of listeners.

Type
number

listeners(event)

Return the listeners registered for a given event.

Parameters:
Name Type Description
event string | symbol

The event name.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 21)
Returns:

The registered listeners.

Type
Array.<function()>

listeners(event)

Return the listeners registered for a given event.

Parameters:
Name Type Description
event string | symbol

The event name.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 8)
Returns:

The registered listeners.

Type
Array.<function()>

off(event [, fn] [, context] [, once])

Remove the listeners of a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 220)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

off(event [, fn] [, context] [, once])

Remove the listeners of a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 203)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

on(event, fn [, context])

Add a listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 85)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

on(event, fn [, context])

Add a listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 101)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

once(event, fn [, context])

Add a one-time listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 143)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

once(event, fn [, context])

Add a one-time listener for a given event.

Parameters:
Name Type Argument Default Description
event string | symbol

The event name.

fn function

The listener function.

context * <optional>
this

The context to invoke the listener with.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 159)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

removeAllListeners( [event])

Remove all listeners, or those of the specified event.

Parameters:
Name Type Argument Description
event string | symbol <optional>

The event name.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 234)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

removeAllListeners( [event])

Remove all listeners, or those of the specified event.

Parameters:
Name Type Argument Description
event string | symbol <optional>

The event name.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 247)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

removeListener(event [, fn] [, context] [, once])

Remove the listeners of a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 189)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

removeListener(event [, fn] [, context] [, once])

Remove the listeners of a given event.

Parameters:
Name Type Argument Description
event string | symbol

The event name.

fn function <optional>

Only remove the listeners that match this function.

context * <optional>

Only remove the listeners that have this context.

once boolean <optional>

Only remove one-time listeners.

Since: 3.0.0
Overrides:
Source: src/scene/typedefs/SceneEventEmitter.js (Line 172)
Returns:

this.

Type
Phaser.Types.Scenes.SceneEventEmitter

shutdown()

Removes all listeners.

Since: 3.0.0
Inherited From:
Source: src/events/EventEmitter.js (Line 31)