Class signals.Signal
Defined in: signals.js.
Custom event broadcaster
- inspired by Robert Penner's AS3 Signals.
Author: Miller Medeiros.
Add a listener to the signal.
- Parameters:
- {Function} listener
- Signal handler function.
- {Object} scope 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. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
- Returns:
- {SignalBinding} An Object representing the binding between the Signal and listener.
Add listener to the signal that should be removed after first execution (will be executed only once).
- Parameters:
- {Function} listener
- Signal handler function.
- {Object} scope 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. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
- Returns:
- {SignalBinding} An Object representing the binding between the Signal and listener.
Dispatch/Broadcast Signal to all listeners added to the queue.
- Parameters:
- {...*} params Optional
- Parameters that should be passed to each handler.
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.
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.
- See:
- signals.Signal.prototype.disable
Check if listener was attached to Signal.
- Parameters:
- {Function} listener
- Returns:
- {boolean} if Signal has the specified listener.