Index

Classes

Class

Fields

Methods

Class SignalBinding


Defined in: signals.js.

Class Detail
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 called by regular users.
- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.


Author: Miller Medeiros.
Parameters:
{Signal} signal
Reference to Signal object that listener is currently bound to.
{Function} listener
Handler function bound to the signal.
{boolean} isOnce
If binding should be executed just once.
{Object} listenerContext Optional
Context on which listener will be executed (object that should represent the `this` variable inside listener function).
{Number} priority Optional
The priority level of the event listener. (default = 0).
Field Detail
{boolean} active

If binding is active and should be executed.

{Object|undefined|null} context

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

{Array|null} params

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

Method Detail
{Function|null} detach()

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

Returns:
{Function|null} Handler function bound to the signal or `null` if binding was previously detached.
{*} execute(paramsArr)

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:
{Array} paramsArr Optional
Array of parameters that should be passed to the listener
Returns:
{*} Value returned by the listener.
{Function} getListener()
Returns:
{Function} Handler function bound to the signal.
{Signal} getSignal()
Returns:
{Signal} Signal that listener is currently bound to.
{Boolean} isBound()
Returns:
{Boolean} `true` if binding is still bound to the signal and have a listener.
{boolean} isOnce()
Returns:
{boolean} If SignalBinding will only be executed once.
{string} toString()
Returns:
{string} String representation of the object.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Oct 31 2012 12:25:34 GMT-0200 (BRST) | template based on Steffen Siering jsdoc-simple.