Class: SignalBinding

Phaser. SignalBinding

Phaser.SignalBinding

new SignalBinding(signal, listener, isOnce, listenerContext, priority)

Object that represents a binding between a Signal and a listener function. This is an internal constructor and shouldn't be created directly. Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.

Parameters:
Name Type Argument Description
signal Phaser.Signal

Reference to Signal object that listener is currently bound to.

listener function

Handler function bound to the signal.

isOnce boolean

If binding should be executed just once.

listenerContext object <optional>

Context on which listener will be executed (object that should represent the this variable inside listener function).

priority number <optional>

The priority level of the event listener. (default = 0).

Source - core/SignalBinding.js, line 21

Members

active :boolean

If binding is active and should be executed.

Default Value:
  • true
Source - core/SignalBinding.js, line 62

callCount :number

The number of times the handler function has been called.

Source - core/SignalBinding.js, line 55

context :object|undefined|null

Context on which listener will be executed (object that should represent the this variable inside listener function).

Type:
  • object | undefined | null
Source - core/SignalBinding.js, line 38

params :array|null

Default parameters passed to listener during Signal.dispatch and SignalBinding.execute (curried parameters).

Type:
  • array | null
Default Value:
  • null
Source - core/SignalBinding.js, line 69

Methods

detach() → {function|null}

Detach binding from signal. alias to: @see mySignal.remove(myBinding.getListener());

Returns:
function | null -

Handler function bound to the signal or null if binding was previously detached.

Source - core/SignalBinding.js, line 102

execute(paramsArr) → {any}

Call listener passing arbitrary parameters. If binding was added using Signal.addOnce() it will be automatically removed from signal dispatch queue, this method is used internally for the signal dispatch.

Parameters:
Name Type Argument Description
paramsArr array <optional>

Array of parameters that should be passed to the listener.

Returns:
any -

Value returned by the listener.

Source - core/SignalBinding.js, line 75

getListener() → {function}

Returns:
function -

Handler function bound to the signal.

Source - core/SignalBinding.js, line 128

getSignal() → {Phaser.Signal}

Returns:

Signal that listener is currently bound to.

Source - core/SignalBinding.js, line 136

isBound() → {boolean}

Returns:
boolean -

True if binding is still bound to the signal and has a listener.

Source - core/SignalBinding.js, line 112

isOnce() → {boolean}

Returns:
boolean -

If SignalBinding will only be executed once.

Source - core/SignalBinding.js, line 120

toString() → {string}

Returns:
string -

String representation of the object.

Source - core/SignalBinding.js, line 155
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Sat Nov 15 2014 19:54:58 GMT-0000 (GMT) using the DocStrap template.