Kiwi.SignalBinding Class
An 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.
Released under the MIT license http://millermedeiros.github.com/js-signals/
Constructor
Kiwi.SignalBinding
-
signal
-
listener
-
isOnce
-
[listenerContext]
-
[priority=0]
Parameters:
-
signal
Kiwi.SignalReference to Signal object that listener is currently bound to.
-
listener
FunctionHandler function bound to the signal.
-
isOnce
BooleanIf binding should be executed just once.
-
[listenerContext]
Object optionalContext on which listener will be executed (object that should represent the
this
variable inside listener function). -
[priority=0]
Number optionalThe priority level of the event listener. (default = 0).
Returns:
Item Index
Methods
_destory
()
public
Delete instance properties
detach
()
Function | Null
public
Detach this binding from the Signal it is attached to. Alias for 'Signal.remove()'
Returns:
Handler function bound to the signal or null
if binding was previously detached.
execute
-
[paramsArr]
Call listener passing arbitrary parameters.
If this 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:
-
[paramsArr]
Array optional multipleArray of parameters that should be passed to the listener
Returns:
Value returned by the listener.
getListener
()
Function
public
Returns the Handler function bound to the Signal.
Returns:
Handler function bound to the signal.
getSignal
()
Kiwi.Signal
public
Returns the signal which this Binding is currently attached to.
Returns:
Signal that listener is currently bound to.
isBound
()
Boolean
public
Checks to see if this Binding is still bound to a Signal and contains a listener.
Returns:
true
if binding is still bound to the signal and have a listener.
isOnce
()
Boolean
public
Returns a boolean indicating whether this event will be exectued just once or not.
Returns:
If SignalBinding will only be executed once.
objType
()
String
public
The type of object that this is.
Returns:
"SignalBinding"
Properties
_isOnce
Boolean
private
If binding should be executed just once.
_listener
Function
private
Handler function bound to the signal.
active
Boolean
public
If binding is active and should be executed.
Default: true
context
Any
public
Context on which listener will be executed (object that should represent the this
variable inside listener function).
params
Any
public
Default parameters passed to listener during Signal.dispatch
and SignalBinding.execute
. (curried parameters)
Default: null
priority
Number
public
Listener priority