Kiwi.Signal Class
A TypeScript conversion of JS Signals by Miller Medeiros. Released under the MIT license http://millermedeiros.github.com/js-signals/
Methods
_addBinding
-
binding
Handles the process of adding a new SignalBinding to the bindings list by the new Bindings priority.
Parameters:
-
binding
Kiwi.SignalBinding
_indexOfListener
-
listener
-
context
Returns the index of any Binding which matches the listener and context that is passed. If none match then this method returns -1.
Parameters:
-
listener
FunctionThe method that we are checking to see.
-
context
AnyThe context of the method we are checking.
Returns:
The index of listener/context.
dispatch
-
[params]
Dispatch/Broadcast Signal to all listeners added to the queue.
Parameters:
-
[params]
Any optional multipleParameters that should be passed to each handler.
dispose
()
public
Remove all bindings from signal and destroy any reference to external objects (destroy Signal object).
IMPORTANT: calling any method on the signal instance after calling dispose will throw errors.
forget
()
public
Forget memorized arguments. See Signal.memorize
getNumListeners
()
Number
public
Returns the number of listeners that have been attached to this Signal.
Returns:
Number of listeners attached to the Signal.
halt
()
public
Stop propagation of the event, blocking the dispatch to next listeners on the queue.
IMPORTANT: should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.
objType
()
String
public
Returns the type of this object
Returns:
"Signal"
removeAll
()
public
Remove all listeners from the Signal.
resume
()
public
Resume propagation of the event, resuming the dispatch to next listeners on the queue.
IMPORTANT: should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.
validateListener
-
listener
-
fnName
Validates a event listener an is used to check to see if it is valid or not. If a event listener is not valid, then a Error is thrown.
Parameters:
-
listener
Any -
fnName
Any
Properties
_bindings
Array
private
A list of all of the signal bindings that are on this signal.
_prevParams
Any
private
active
Boolean
public
If Signal is active and should broadcast events.
IMPORTANT: Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use halt()
instead.
Default: true
memorize
Boolean
public
If Signal should keep record of previously dispatched parameters and
automatically execute listener during add()
/addOnce()
if Signal was
already dispatched before.
Default: false
VERSION
String
public
final
static
Signals Version Number