Class: SignalBinding

Phaser. SignalBinding

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

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

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).

Author:
  • Miller Medeiros http://millermedeiros.github.com/js-signals/
Source:

Members

active

If binding is active and should be executed.

Properties:
Name Type Description
active boolean
Default Value:
  • true
Source:

context

Properties:
Name Type Description
context object | undefined | null

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

Source:

params

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

Properties:
Name Type Description
params array | null
Default Value:
  • null
Source:

Methods

detach() → {function|null}

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

Source:
Returns:

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

Type
function | null

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.

Source:
Returns:

Value returned by the listener.

Type
any

getListener() → {function}

Source:
Returns:

Handler function bound to the signal.

Type
function

getSignal() → {Signal}

Source:
Returns:

Signal that listener is currently bound to.

Type
Signal

isBound() → {boolean}

Source:
Returns:

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

Type
boolean

isOnce() → {boolean}

Source:
Returns:

If SignalBinding will only be executed once.

Type
boolean

toString() → {string}

Source:
Returns:

String representation of the object.

Type
string
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Fri Apr 11 2014 13:25:20 GMT+0100 (BST) using the DocStrap template.