Browse files

Merge branch 'release-0.5'

  • Loading branch information...
2 parents 80cce08 + 6079634 commit 253fac7ee65c397a1420f1aa58d3ea1c209ec349 @millermedeiros committed Dec 3, 2010
View
37 CHANGELOG.markdown
@@ -2,6 +2,41 @@
+## v0.5 (2010/12/03) ##
+
+### API changes ###
+
+ - Added:
+ - `SignalBinding.prototype.getListener()` (issue #3)
+ - `Signal.dispose()` (issue #6)
+ - `signals.VERSION`
+ - `signals.isDef()`
+
+ - Removed:
+ - `SignalBinding.listener` (issue #3)
+
+ - Renamed:
+ - `SignalBinding.listenerScope` -> `SignalBinding.context` (issue #4)
+
+### Fixes ###
+
+ - Removed unnecessary function names (issue #5)
+ - Improved `remove()`, `removeAll()` to dispose binding (issue #10)
+
+### Test Changes ###
+
+ - Added different HTML files to test dev/dist/min files.
+ - Updated test cases to match new API.
+
+### Other ###
+
+ - Improved source code comments and documentation.
+ - Small refactoring for better organization and DRY.
+ - Added error messages for required params.
+ - Removed unnecessary info from `SignalBinding.toString()`.
+
+
+
## v0.4 (2010/11/27) ##
### API changes ###
@@ -45,7 +80,7 @@
### Other ###
-Added inline documentation to source codeand included an HTML version of the documentation together with distribution files.
+Added inline documentation to source code and included an HTML version of the documentation together with distribution files.
View
2 build.xml
@@ -33,6 +33,7 @@
<concat destfile="${dist.dir}/${dist.name}" fixlastline="yes" eol="unix">
<filelist dir="${src.dir}">
<file name="intro.js" />
+ <file name="signals.js" />
<file name="Signal.js" />
<file name="SignalBinding.js" />
<file name="outro.js" />
@@ -59,6 +60,7 @@
<arg path="${yuicompressor.jar}" />
<arg value="--charset" />
<arg value="ANSI" />
+ <arg value="-v" />
<arg value="-o" />
<targetfile />
<mapper type="glob" from="${dist.name}" to="${dist.min.name}" />
View
4 dev/build/build.number
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
-#Sat Nov 27 16:19:16 EST 2010
-build.number=65
+#Fri Dec 03 17:27:32 EST 2010
+build.number=101
View
2 dev/build/build.properties
@@ -6,6 +6,6 @@ docs.dir = ${dist.dir}/docs
jsdoc-toolkit.dir = ${build.dir}/jsdoc-toolkit
yuicompressor.jar = ${build.dir}/yuicompressor/yuicompressor-2.4.2.jar
product.name = js-signals
-version.number = 0.4
+version.number = 0.5
dist.name = ${product.name}.js
dist.min.name = ${product.name}.min.js
View
76 dev/src/Signal.js
@@ -1,12 +1,13 @@
/**
- * Signal - custom event broadcaster inpired by Robert Penner's AS3Signals <https://github.com/robertpenner/as3-signals/>
+ * Signal - custom event broadcaster
+ * <br />- inspired by Robert Penner's AS3 Signals.
* @author Miller Medeiros
* @constructor
*/
signals.Signal = function(){
/**
- * @type Array.<SignalBinding>
+ * @type Array.<signals.SignalBinding>
* @private
*/
this._bindings = [];
@@ -30,18 +31,21 @@
/**
* @param {Function} listener
* @param {boolean} isOnce
- * @param {Object} scope
+ * @param {Object} [scope]
* @return {signals.SignalBinding}
* @private
*/
- _registerListener : function _registerListener(listener, isOnce, scope){
+ _registerListener : function(listener, isOnce, scope){
+
+ if(!signals.isDef(listener)) throw new Error('listener is a required param of add() and addOnce().');
+
var prevIndex = this._indexOfListener(listener),
binding;
if(prevIndex !== -1){ //avoid creating a new Binding for same listener if already added to list
binding = this._bindings[prevIndex];
if(binding.isOnce() !== isOnce){
- throw new Error('You cannot '+ (isOnce? 'add()' : 'addOnce()') +' then '+ (!isOnce? 'add()' : 'addOnce()') +' the same listener without removing the relationship first.');
+ throw new Error('You cannot add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.');
}
} else {
binding = new signals.SignalBinding(listener, isOnce, scope, this);
@@ -55,7 +59,7 @@
* @param {signals.SignalBinding} binding
* @private
*/
- _addBinding : function _addBinding(binding){
+ _addBinding : function(binding){
this._bindings.push(binding);
},
@@ -64,97 +68,108 @@
* @return {int}
* @private
*/
- _indexOfListener : function _indexOfListener(listener){
+ _indexOfListener : function(listener){
var n = this._bindings.length;
while(n--){
- if(this._bindings[n].listener === listener) return n;
+ if(this._bindings[n]._listener === listener) return n;
}
return -1;
},
/**
* Add a listener to the signal.
* @param {Function} listener Signal handler function.
- * @param {Object} scope Context on which listener will be executed (object that should represent the `this` variable inside listener function).
+ * @param {Object} [scope] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @return {signals.SignalBinding} An Object representing the binding between the Signal and listener.
*/
- add : function add(listener, scope){
+ add : function(listener, scope){
return this._registerListener(listener, false, scope);
},
/**
* Add listener to the signal that should be removed after first execution (will be executed only once).
* @param {Function} listener Signal handler function.
- * @param {Object} scope Context on which listener will be executed (object that should represent the `this` variable inside listener function).
+ * @param {Object} [scope] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @return {signals.SignalBinding} An Object representing the binding between the Signal and listener.
*/
- addOnce : function addOnce(listener, scope){
+ addOnce : function(listener, scope){
return this._registerListener(listener, true, scope);
},
/**
+ * @private
+ */
+ _removeByIndex : function(i){
+ this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal
+ this._bindings.splice(i, 1);
+ },
+
+ /**
* Remove a single listener from the dispatch queue.
* @param {Function} listener Handler function that should be removed.
* @return {Function} Listener handler function.
*/
- remove : function remove(listener){
+ remove : function(listener){
+ if(!signals.isDef(listener)) throw new Error('listener is a required param of remove().');
+
var i = this._indexOfListener(listener);
- if(i !== -1){
- this._bindings.splice(i, 1);
- }
+ if(i !== -1) this._removeByIndex(i);
return listener;
},
/**
* Remove all listeners from the Signal.
*/
- removeAll : function removeAll(){
- this._bindings.length = 0;
+ removeAll : function(){
+ var n = this._bindings.length;
+ while(n--){
+ this._removeByIndex(n);
+ }
},
/**
* @return {uint} Number of listeners attached to the Signal.
*/
- getNumListeners : function getNumListeners(){
+ getNumListeners : function(){
return this._bindings.length;
},
/**
* Disable Signal, will block dispatch to listeners until `enable()` is called.
* @see signals.Signal.prototype.enable
*/
- disable : function disable(){
+ disable : function(){
this._isEnabled = false;
},
/**
* Enable broadcast to listeners.
* @see signals.Signal.prototype.disable
*/
- enable : function enable(){
+ enable : function(){
this._isEnabled = true;
},
/**
* @return {boolean} If Signal is currently enabled and will broadcast message to listeners.
*/
- isEnabled : function isEnabled(){
+ isEnabled : function(){
return this._isEnabled;
},
/**
* Stop propagation of the event, blocking the dispatch to next listeners on the queue.
* - should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.
*/
- halt : function halt(){
+ halt : function(){
this._shouldPropagate = false;
},
/**
* Dispatch/Broadcast Signal to all listeners added to the queue.
- * @param {...*} params Parameters that should be passed to each handler.
+ * @param {...*} [params] Parameters that should be passed to each handler.
*/
- dispatch : function dispatch(params){
+ dispatch : function(params){
if(! this._isEnabled) return;
var paramsArr = Array.prototype.slice.call(arguments),
@@ -170,9 +185,18 @@
},
/**
+ * Remove binding from signal and destroy any reference to external Objects (destroy Signal object).
+ * <br /> - calling methods on the signal instance after calling dispose will throw errors.
+ */
+ dispose : function(){
+ this.removeAll();
+ delete this._bindings;
+ },
+
+ /**
* @return {string} String representation of the object.
*/
- toString : function toString(){
+ toString : function(){
return '[Signal isEnabled: '+ this._isEnabled +' numListeners: '+ this.getNumListeners() +']';
}
View
71 dev/src/SignalBinding.js
@@ -1,22 +1,23 @@
/**
* Object that represents a binding between a Signal and a listener function.
- * <br />- Constructor shouldn't be called by regular user, no point on creating a new binding without a Signal.
+ * <br />- <strong>Constructor shouldn't be called by regular user, used internally.</strong>
* <br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
* @author Miller Medeiros
* @constructor
- * @param {Function} listener Handler function binded to the signal.
+ * @param {Function} listener Handler function bound to the signal.
* @param {boolean} isOnce If binding should be executed just once.
- * @param {Object} listenerScope Context on which listener will be executed (object that should represent the `this` variable inside listener function).
- * @param {signals.Signal} signal Reference to Signal object that listener is currently binded to.
+ * @param {?Object} listenerContext Context on which listener will be executed (object that should represent the `this` variable inside listener function).
+ * @param {signals.Signal} signal Reference to Signal object that listener is currently bound to.
*/
- signals.SignalBinding = function SignalBinding(listener, isOnce, listenerScope, signal){
+ signals.SignalBinding = function(listener, isOnce, listenerContext, signal){
/**
- * Handler function binded to the signal.
+ * Handler function bound to the signal.
* @type Function
+ * @private
*/
- this.listener = listener;
+ this._listener = listener;
/**
* If binding should be executed just once.
@@ -29,10 +30,10 @@
* Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @type Object
*/
- this.listenerScope = listenerScope;
+ this.context = listenerContext;
/**
- * Reference to Signal object that listener is currently binded to.
+ * Reference to Signal object that listener is currently bound to.
* @type signals.Signal
* @private
*/
@@ -51,71 +52,89 @@
/**
* Call listener passing arbitrary parameters.
* <p>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.</p>
- * @param {Array} paramsArr Array of parameters that should be passed to the listener
+ * @param {Array} [paramsArr] Array of parameters that should be passed to the listener
* @return {*} Value returned by the listener.
*/
- execute : function execute(paramsArr){
+ execute : function(paramsArr){
+ var r;
if(this._isEnabled){
+ r = this._listener.apply(this.context, paramsArr);
if(this._isOnce) this.detach();
- return this.listener.apply(this.listenerScope, paramsArr);
}
+ return r; //avoid warnings on some editors
},
/**
* Detach binding from signal.
- * - alias to: mySignal.remove(myBinding.listener);
- * @return {Function} Handler function binded to the signal.
+ * - alias to: mySignal.remove(myBinding.getListener());
+ * @return {Function} Handler function bound to the signal.
+ */
+ detach : function(){
+ return this._signal.remove(this._listener);
+ },
+
+ /**
+ * @return {Function} Handler function bound to the signal.
*/
- detach : function detach(){
- return this._signal.remove(this.listener);
+ getListener : function(){
+ return this._listener;
},
/**
* Remove binding from signal and destroy any reference to external Objects (destroy SignalBinding object).
+ * <br /> - calling methods on the binding instance after calling dispose will throw errors.
*/
- dispose : function dispose(){
+ dispose : function(){
this.detach();
- //remove reference to all objects
+ this._destroy();
+ },
+
+ /**
+ * Delete all instance properties
+ * @private
+ */
+ _destroy : function(){
delete this._signal;
- delete this.listener;
- delete this.listenerScope;
+ delete this._isOnce;
+ delete this._listener;
+ delete this.context;
},
/**
* Disable SignalBinding, block listener execution. Listener will only be executed after calling `enable()`.
* @see signals.SignalBinding.enable()
*/
- disable : function disable(){
+ disable : function(){
this._isEnabled = false;
},
/**
* Enable SignalBinding. Enable listener execution.
* @see signals.SignalBinding.disable()
*/
- enable : function enable(){
+ enable : function(){
this._isEnabled = true;
},
/**
* @return {boolean} If SignalBinding is currently paused and won't execute listener during dispatch.
*/
- isEnabled : function isEnabled(){
+ isEnabled : function(){
return this._isEnabled;
},
/**
* @return {boolean} If SignalBinding will only be executed once.
*/
- isOnce : function isOnce(){
+ isOnce : function(){
return this._isOnce;
},
/**
* @return {string} String representation of the object.
*/
- toString : function toString(){
- return '[SignalBinding listener: '+ this.listener +', isOnce: '+ this._isOnce +', isEnabled: '+ this._isEnabled +', listenerScope: '+ this.listenerScope +']';
+ toString : function(){
+ return '[SignalBinding isOnce: '+ this._isOnce +', isEnabled: '+ this._isEnabled +']';
}
};
View
10 dev/src/intro.js
@@ -1,14 +1,8 @@
-/*!
+/*!!
* JS Signals <https://github.com/millermedeiros/js-signals>
* Released under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* @author Miller Medeiros <http://millermedeiros.com>
* @version ::VERSION_NUMBER::
* @build ::BUILD_NUMBER:: ::BUILD_DATE::
*/
-(function(){
-
- /**
- * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
- * @name signals
- */
- var signals = window.signals = {};
+(function(){
View
21 dev/src/signals.js
@@ -0,0 +1,21 @@
+
+ /**
+ * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
+ * @name signals
+ */
+ var signals = window.signals = {};
+
+ /**
+ * Signals Version Number
+ * @type string
+ * @const
+ */
+ signals.VERSION = '::VERSION_NUMBER::';
+
+ /**
+ * @param {*} param Parameter to check.
+ * @return {boolean} `true` if parameter is different than `undefined`.
+ */
+ signals.isDef = function(param){
+ return typeof param !== 'undefined';
+ };
View
19 dev/tests/dev.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+ <head>
+ <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />
+ <meta http-equiv="content-style-type" content="text/css" />
+ <title>DEV | js-signals unit test</title>
+ <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.2.0/build/cssfonts/fonts-min.css" />
+ </head>
+ <body>
+ <div id="wrapper">
+ <div id="testLogger" class="yui3-skin-sam"></div>
+ </div>
+ <script type="text/javascript" src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
+ <script type="text/javascript" src="../../dev/src/signals.js"></script>
+ <script type="text/javascript" src="../../dev/src/Signal.js"></script>
+ <script type="text/javascript" src="../../dev/src/SignalBinding.js"></script>
+ <script type="text/javascript" src="./src/01.js"></script>
+ </body>
+</html>
View
2 dev/tests/01.html → dev/tests/dist.html
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
- <title>js-signals unit test</title>
+ <title>DIST | js-signals unit test</title>
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.2.0/build/cssfonts/fonts-min.css" />
</head>
<body>
View
17 dev/tests/dist_min.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+ <head>
+ <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />
+ <meta http-equiv="content-style-type" content="text/css" />
+ <title>DIST.MIN | js-signals unit test</title>
+ <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.2.0/build/cssfonts/fonts-min.css" />
+ </head>
+ <body>
+ <div id="wrapper">
+ <div id="testLogger" class="yui3-skin-sam"></div>
+ </div>
+ <script type="text/javascript" src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
+ <script type="text/javascript" src="../../dist/js-signals.min.js"></script>
+ <script type="text/javascript" src="./src/01.js"></script>
+ </body>
+</html>
View
188 dev/tests/src/01.js
@@ -15,8 +15,15 @@ YUI().use('node', 'console', 'test', function (Y){
_should: {
ignore: {},
error : {
- testAddSameListenerMixed1 : true,
- testAddSameListenerMixed2 : true
+ testAddNull : 'listener is a required param of add() and addOnce().',
+ testAddOnceNull : 'listener is a required param of add() and addOnce().',
+ testAddSameListenerMixed1 : 'You cannot add() then addOnce() the same listener without removing the relationship first.',
+ testAddSameListenerMixed2 : 'You cannot addOnce() then add() the same listener without removing the relationship first.',
+ testRemoveNull : 'listener is a required param of remove().',
+ testDispose1 : true,
+ testDispose2 : true,
+ testDispose3 : true,
+ testDispose4 : true
}
},
@@ -61,7 +68,7 @@ YUI().use('node', 'console', 'test', function (Y){
var s = this.signal;
s.add(function(){});
-
+
Y.Assert.areSame(1, s.getNumListeners());
},
@@ -85,6 +92,13 @@ YUI().use('node', 'console', 'test', function (Y){
Y.Assert.areSame(1, s.getNumListeners());
},
+ testAddNull : function(){
+ var s = this.signal;
+
+ s.add(); //should throw error
+ Y.Assert.areSame(0, s.getNumListeners());
+ },
+
//--------------------------- Add Once ---------------------------------//
testAddOnce : function(){
@@ -111,6 +125,13 @@ YUI().use('node', 'console', 'test', function (Y){
Y.Assert.areSame(1, s.getNumListeners());
},
+ testAddOnceNull : function(){
+ var s = this.signal;
+
+ s.addOnce(); //should throw error
+ Y.Assert.areSame(0, s.getNumListeners());
+ },
+
//--------------------------- Add Mixed ---------------------------------//
testAddSameListenerMixed1 : function(){
@@ -827,14 +848,58 @@ YUI().use('node', 'console', 'test', function (Y){
s.dispatch();
},
+ testBindingGetListener : function(){
+ var s = this.signal;
+ var l1 = function(){};
+ var b1 = s.add(l1);
+ Y.Assert.isUndefined(b1.listener); //make sure it's private
+ Y.Assert.areSame(1, s.getNumListeners());
+ Y.Assert.areSame(l1, b1.getListener());
+ },
+
+ testBindingContext : function(){
+ var s = this.signal;
+
+ var scope1 = {
+ n : 0,
+ sum : function(){
+ this.n++;
+ }
+ };
+
+ var scope2 = {
+ n : 0,
+ sum : function(){
+ this.n++;
+ }
+ };
+
+ var l1 = function(){this.sum()};
+ var l2 = function(){this.sum()};
+
+ var b1 = s.add(l1, scope1);
+ var b2 = s.add(l2, scope2);
+ s.dispatch();
+
+ Y.Assert.areSame(1, scope1.n);
+ Y.Assert.areSame(1, scope2.n);
+
+ b1.context = scope2;
+ s.dispatch();
+
+ Y.Assert.areSame(1, scope1.n);
+ Y.Assert.areSame(3, scope2.n);
+ },
+
testBindingDispose : function(){
var s = this.signal;
- var b1 = s.add(function(){});
+ var b1 = s.add(function(){}, {});
Y.Assert.areSame(1, s.getNumListeners());
b1.dispose();
Y.Assert.areSame(0, s.getNumListeners());
Y.Assert.isUndefined(b1.listener);
- Y.Assert.isUndefined(b1.listenerScope);
+ Y.Assert.isUndefined(b1.getListener());
+ Y.Assert.isUndefined(b1.context);
},
@@ -843,11 +908,25 @@ YUI().use('node', 'console', 'test', function (Y){
testRemoveSingle : function(){
var s = this.signal;
- var l = function(){Y.Assert.fail();};
+ var l1 = function(){Y.Assert.fail();};
- s.add(l);
- s.remove(l);
+ var b1 = s.add(l1);
+ s.remove(l1);
+ Y.Assert.areSame(0, s.getNumListeners());
+ s.dispatch();
+ },
+
+ testRemoveSingle2 : function(){
+ var s = this.signal;
+
+ var l1 = function(){Y.Assert.fail();};
+
+ var b1 = s.add(l1);
+ s.remove(l1);
Y.Assert.areSame(0, s.getNumListeners());
+ Y.Assert.isUndefined(b1.listener);
+ Y.Assert.isUndefined(b1.getListener());
+ Y.Assert.isUndefined(b1.context);
s.dispatch();
},
@@ -946,6 +1025,42 @@ YUI().use('node', 'console', 'test', function (Y){
s.dispatch();
},
+ testRemoveAll2 : function(){
+ var s = this.signal;
+
+ var b1 = s.add(function(){Y.Assert.fail();});
+ var b2 = s.add(function(){Y.Assert.fail();});
+ var b3 = s.addOnce(function(){Y.Assert.fail();});
+ var b4 = s.add(function(){Y.Assert.fail();});
+ var b5 = s.addOnce(function(){Y.Assert.fail();});
+
+ Y.Assert.areSame(5, s.getNumListeners());
+ s.removeAll();
+ Y.Assert.areSame(0, s.getNumListeners());
+
+ Y.Assert.isUndefined(b1.listener);
+ Y.Assert.isUndefined(b1.getListener());
+ Y.Assert.isUndefined(b1.context);
+
+ Y.Assert.isUndefined(b2.listener);
+ Y.Assert.isUndefined(b2.getListener());
+ Y.Assert.isUndefined(b2.context);
+
+ Y.Assert.isUndefined(b3.listener);
+ Y.Assert.isUndefined(b3.getListener());
+ Y.Assert.isUndefined(b3.context);
+
+ Y.Assert.isUndefined(b4.listener);
+ Y.Assert.isUndefined(b4.getListener());
+ Y.Assert.isUndefined(b4.context);
+
+ Y.Assert.isUndefined(b5.listener);
+ Y.Assert.isUndefined(b5.getListener());
+ Y.Assert.isUndefined(b5.context);
+
+ s.dispatch();
+ },
+
testRemoveAllTwice : function(){
var s = this.signal;
@@ -960,6 +1075,63 @@ YUI().use('node', 'console', 'test', function (Y){
s.removeAll();
Y.Assert.areSame(0, s.getNumListeners());
s.dispatch();
+ },
+
+ testRemoveNull : function(){
+ var s = this.signal;
+
+ var l1 = function(){Y.Assert.fail();};
+
+ var b1 = s.add(l1);
+ s.remove(); //should throw error
+ Y.Assert.areSame(0, s.getNumListeners());
+ s.dispatch();
+ },
+
+ //--------------------- Dispose --------------------------//
+
+ testDispose1 : function(){
+ var s = this.signal;
+
+ s.addOnce(function(){});
+ s.add(function(){});
+ Y.Assert.areSame(2, s.getNumListeners());
+
+ s.dispose();
+ s.dispatch(); //will throw error
+ },
+
+ testDispose2 : function(){
+ var s = this.signal;
+
+ s.addOnce(function(){});
+ s.add(function(){});
+ Y.Assert.areSame(2, s.getNumListeners());
+
+ s.dispose();
+ s.add(function(){}); //will throw error
+ },
+
+ testDispose3 : function(){
+ var s = this.signal;
+
+ s.addOnce(function(){});
+ s.add(function(){});
+ Y.Assert.areSame(2, s.getNumListeners());
+
+ s.dispose();
+ s.remove(function(){}); //will throw error
+ },
+
+ testDispose4 : function(){
+ var s = this.signal;
+
+ s.addOnce(function(){});
+ s.add(function(){});
+ Y.Assert.areSame(2, s.getNumListeners());
+
+ s.dispose();
+ s.getNumListeners(); //will throw error
}
});
View
4 dist/docs/files.html
@@ -46,7 +46,7 @@ <h1 class="classTitle">File Index</h1>
<div class="member">
- <h2><a href="symbols/src/D__Projetos_millermedeiros_js-signals_dist_js-signals.js.html">D:\Projetos\millermedeiros\js-signals\dist\js-signals.js</a></h2>
+ <h2><a href="symbols/src/C__Miller_Personal_open_source_projects_js-signals_dist_js-signals.js.html">C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js</a></h2>
<dl>
@@ -61,7 +61,7 @@ <h1 class="classTitle">File Index</h1>
</div>
<div class="fineprint" style="clear:both;text-align:center">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Nov 27 2010 16:19:19 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Dec 03 2010 17:27:36 GMT-0500 (EST)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
View
2 dist/docs/index.html
@@ -85,7 +85,7 @@ <h1 class="classTitle">Class Index</h1>
</div>
<div class="fineprint" style="clear:both;text-align:center">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Nov 27 2010 16:19:19 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Dec 03 2010 17:27:36 GMT-0500 (EST)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
View
50 dist/docs/symbolindex.html
@@ -107,6 +107,15 @@ <h1 id="classTitle">Symbol Index</h1>
</tr>
<tr class="symbolEntry">
+ <td class="symbolName">context</td>
+ <td>
+
+ <a href="symbols/signals.SignalBinding.html#context">signals.SignalBinding#context</a>
+
+ </td>
+ </tr>
+
+ <tr class="symbolEntry">
<td class="symbolName">detach</td>
<td>
@@ -139,6 +148,8 @@ <h1 id="classTitle">Symbol Index</h1>
<td class="symbolName">dispose</td>
<td>
+ <a href="symbols/signals.Signal.html#dispose">signals.Signal#dispose</a>
+
<a href="symbols/signals.SignalBinding.html#dispose">signals.SignalBinding#dispose</a>
</td>
@@ -165,57 +176,57 @@ <h1 id="classTitle">Symbol Index</h1>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">getNumListeners</td>
+ <td class="symbolName">getListener</td>
<td>
- <a href="symbols/signals.Signal.html#getNumListeners">signals.Signal#getNumListeners</a>
+ <a href="symbols/signals.SignalBinding.html#getListener">signals.SignalBinding#getListener</a>
</td>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">halt</td>
+ <td class="symbolName">getNumListeners</td>
<td>
- <a href="symbols/signals.Signal.html#halt">signals.Signal#halt</a>
+ <a href="symbols/signals.Signal.html#getNumListeners">signals.Signal#getNumListeners</a>
</td>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">isEnabled</td>
+ <td class="symbolName">halt</td>
<td>
- <a href="symbols/signals.Signal.html#isEnabled">signals.Signal#isEnabled</a>
-
- <a href="symbols/signals.SignalBinding.html#isEnabled">signals.SignalBinding#isEnabled</a>
+ <a href="symbols/signals.Signal.html#halt">signals.Signal#halt</a>
</td>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">isOnce</td>
+ <td class="symbolName">isDef</td>
<td>
- <a href="symbols/signals.SignalBinding.html#isOnce">signals.SignalBinding#isOnce</a>
+ <a href="symbols/signals.html#.isDef">signals.isDef</a>
</td>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">listener</td>
+ <td class="symbolName">isEnabled</td>
<td>
- <a href="symbols/signals.SignalBinding.html#listener">signals.SignalBinding#listener</a>
+ <a href="symbols/signals.Signal.html#isEnabled">signals.Signal#isEnabled</a>
+
+ <a href="symbols/signals.SignalBinding.html#isEnabled">signals.SignalBinding#isEnabled</a>
</td>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">listenerScope</td>
+ <td class="symbolName">isOnce</td>
<td>
- <a href="symbols/signals.SignalBinding.html#listenerScope">signals.SignalBinding#listenerScope</a>
+ <a href="symbols/signals.SignalBinding.html#isOnce">signals.SignalBinding#isOnce</a>
</td>
</tr>
@@ -276,13 +287,22 @@ <h1 id="classTitle">Symbol Index</h1>
</td>
</tr>
+ <tr class="symbolEntry">
+ <td class="symbolName">VERSION</td>
+ <td>
+
+ <a href="symbols/signals.html#.VERSION">signals.VERSION</a>
+
+ </td>
+ </tr>
+
</table>
</div>
<hr />
</div>
<div class="fineprint" style="clear:both;text-align:center">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Nov 27 2010 16:19:19 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Dec 03 2010 17:27:36 GMT-0500 (EST)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
View
2 dist/docs/symbols/_global_.html
@@ -101,7 +101,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both;text-align:center">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Nov 27 2010 16:19:19 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Dec 03 2010 17:27:36 GMT-0500 (EST)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
View
45 dist/docs/symbols/signals.Signal.html
@@ -88,6 +88,10 @@
</li>
<li class="fixedFont">
+ <a href="../symbols/signals.Signal.html#dispose">dispose</a>
+ </li>
+
+ <li class="fixedFont">
<a href="../symbols/signals.Signal.html#enable">enable</a>
</li>
@@ -139,7 +143,7 @@ <h1 class="classTitle">
- <br /><i>Defined in: </i> <a href="../symbols/src/D__Projetos_millermedeiros_js-signals_dist_js-signals.js.html">js-signals.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/C__Miller_Personal_open_source_projects_js-signals_dist_js-signals.js.html">js-signals.js</a>.
</p>
@@ -155,7 +159,8 @@ <h1 class="classTitle">
</div>
<div class="description">
- <p>Signal - custom event broadcaster inpired by Robert Penner's AS3Signals <a href="https://github.com/robertpenner/as3-signals/">https://github.com/robertpenner/as3-signals/</a></p>
+ <p>Signal - custom event broadcaster
+<br />- inspired by Robert Penner's AS3 Signals.</p>
<br /><i>Author: </i>Miller Medeiros.
</div>
@@ -212,7 +217,7 @@ <h1 class="classTitle">
<dt>
<span class="light fixedFont">{Object}</span> <b>scope</b>
-
+ <i>Optional</i>
</dt>
<dd>Context on which listener will be executed (object that should represent the `this` variable inside listener function).</dd>
@@ -263,7 +268,7 @@ <h1 class="classTitle">
<dt>
<span class="light fixedFont">{Object}</span> <b>scope</b>
-
+ <i>Optional</i>
</dt>
<dd>Context on which listener will be executed (object that should represent the `this` variable inside listener function).</dd>
@@ -342,7 +347,7 @@ <h1 class="classTitle">
<dt>
<span class="light fixedFont">{...*}</span> <b>params</b>
-
+ <i>Optional</i>
</dt>
<dd>Parameters that should be passed to each handler.</dd>
@@ -358,6 +363,34 @@ <h1 class="classTitle">
</div>
<div class="member">
+ <a name="dispose"> </a>
+ <div class="fixedFont">
+ <div class="modifiers">
+ </div>
+
+ <b>dispose</b>()
+
+ </div>
+ <div class="description">
+ <p>Remove binding from signal and destroy any reference to external Objects (destroy Signal object).
+<br /> - calling methods on the signal instance after calling dispose will throw errors.</p>
+
+
+ </div>
+
+
+
+
+
+
+
+
+
+
+
+ </div>
+
+ <div class="member">
<a name="enable"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -605,7 +638,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both;text-align:center">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Nov 27 2010 16:19:19 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Dec 03 2010 17:27:36 GMT-0500 (EST)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
View
95 dist/docs/symbols/signals.SignalBinding.html
@@ -67,11 +67,7 @@
<ul>
<li class="fixedFont">
- <a href="../symbols/signals.SignalBinding.html#listener">listener</a>
- </li>
-
- <li class="fixedFont">
- <a href="../symbols/signals.SignalBinding.html#listenerScope">listenerScope</a>
+ <a href="../symbols/signals.SignalBinding.html#context">context</a>
</li>
</ul>
@@ -105,6 +101,10 @@
</li>
<li class="fixedFont">
+ <a href="../symbols/signals.SignalBinding.html#getListener">getListener</a>
+ </li>
+
+ <li class="fixedFont">
<a href="../symbols/signals.SignalBinding.html#isEnabled">isEnabled</a>
</li>
@@ -140,7 +140,7 @@ <h1 class="classTitle">
- <br /><i>Defined in: </i> <a href="../symbols/src/D__Projetos_millermedeiros_js-signals_dist_js-signals.js.html">js-signals.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/C__Miller_Personal_open_source_projects_js-signals_dist_js-signals.js.html">js-signals.js</a>.
</p>
@@ -152,12 +152,12 @@ <h1 class="classTitle">
</div>
<div class="fixedFont">
- <b>signals.SignalBinding</b>(listener, isOnce, listenerScope, signal)
+ <b>signals.SignalBinding</b>(listener, isOnce, listenerContext, signal)
</div>
<div class="description">
<p>Object that represents a binding between a Signal and a listener function.
-<br />- Constructor shouldn't be called by regular user, no point on creating a new binding without a Signal.
+<br />- <strong>Constructor shouldn't be called by regular user, used internally.</strong>
<br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.</p>
<br /><i>Author: </i>Miller Medeiros.
</div>
@@ -173,7 +173,7 @@ <h1 class="classTitle">
<span class="light fixedFont">{Function}</span> <b>listener</b>
</dt>
- <dd>Handler function binded to the signal.</dd>
+ <dd>Handler function bound to the signal.</dd>
<dt>
<span class="light fixedFont">{boolean}</span> <b>isOnce</b>
@@ -182,7 +182,7 @@ <h1 class="classTitle">
<dd>If binding should be executed just once.</dd>
<dt>
- <span class="light fixedFont">{Object}</span> <b>listenerScope</b>
+ <span class="light fixedFont">{?Object}</span> <b>listenerContext</b>
</dt>
<dd>Context on which listener will be executed (object that should represent the `this` variable inside listener function).</dd>
@@ -191,7 +191,7 @@ <h1 class="classTitle">
<span class="light fixedFont">{<a href="../symbols/signals.Signal.html">signals.Signal</a>}</span> <b>signal</b>
</dt>
- <dd>Reference to Signal object that listener is currently binded to.</dd>
+ <dd>Reference to Signal object that listener is currently bound to.</dd>
</dl>
@@ -213,37 +213,13 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="listener"> </a>
- <div class="fixedFont">
- <div class="modifiers">
- </div>
-
- <span class="light">{Function}</span>
- <b>listener</b>
-
- </div>
- <div class="description">
- <p>Handler function binded to the signal.</p>
-
-
- </div>
-
-
-
-
-
-
-
- </div>
-
- <div class="member">
- <a name="listenerScope"> </a>
+ <a name="context"> </a>
<div class="fixedFont">
<div class="modifiers">
</div>
<span class="light">{Object}</span>
- <b>listenerScope</b>
+ <b>context</b>
</div>
<div class="description">
@@ -281,7 +257,7 @@ <h1 class="classTitle">
</div>
<div class="description">
<p>Detach binding from signal.
-- alias to: mySignal.remove(myBinding.listener);</p>
+- alias to: mySignal.remove(myBinding.getListener());</p>
</div>
@@ -296,7 +272,7 @@ <h1 class="classTitle">
<dl class="detailList">
<dt class="heading">Returns:</dt>
- <dd><span class="light fixedFont">{Function}</span> Handler function binded to the signal.</dd>
+ <dd><span class="light fixedFont">{Function}</span> Handler function bound to the signal.</dd>
</dl>
@@ -349,7 +325,8 @@ <h1 class="classTitle">
</div>
<div class="description">
- <p>Remove binding from signal and destroy any reference to external Objects (destroy SignalBinding object).</p>
+ <p>Remove binding from signal and destroy any reference to external Objects (destroy SignalBinding object).
+<br /> - calling methods on the binding instance after calling dispose will throw errors.</p>
</div>
@@ -425,7 +402,7 @@ <h1 class="classTitle">
<dt>
<span class="light fixedFont">{Array}</span> <b>paramsArr</b>
-
+ <i>Optional</i>
</dt>
<dd>Array of parameters that should be passed to the listener</dd>
@@ -448,6 +425,40 @@ <h1 class="classTitle">
</div>
<div class="member">
+ <a name="getListener"> </a>
+ <div class="fixedFont">
+ <div class="modifiers">
+ </div>
+ <span class="light">{Function}</span>
+ <b>getListener</b>()
+
+ </div>
+ <div class="description">
+
+
+
+ </div>
+
+
+
+
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Returns:</dt>
+
+ <dd><span class="light fixedFont">{Function}</span> Handler function bound to the signal.</dd>
+
+ </dl>
+
+
+
+
+ </div>
+
+ <div class="member">
<a name="isEnabled"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -561,7 +572,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both;text-align:center">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Nov 27 2010 16:19:19 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Dec 03 2010 17:27:36 GMT-0500 (EST)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
View
105 dist/docs/symbols/signals.html
@@ -63,11 +63,29 @@
<!-- properties list -->
+ <h3>Variables</h3>
+ <ul>
+
+ <li class="fixedFont">
+ <a href="../symbols/signals.html#.VERSION">VERSION</a>
+ </li>
+
+ </ul>
+
<!-- end properties list -->
<!-- function summary -->
+ <h3>Functions</h3>
+ <ul>
+
+ <li class="fixedFont">
+ <a href="../symbols/signals.html#.isDef">isDef</a>
+ </li>
+
+ </ul>
+
<!-- end function summary -->
<!-- events summary -->
@@ -90,7 +108,7 @@ <h1 class="classTitle">
Signals Namespace - Custom event/messaging system based on AS3 Signals
- <br /><i>Defined in: </i> <a href="../symbols/src/D__Projetos_millermedeiros_js-signals_dist_js-signals.js.html">js-signals.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/C__Miller_Personal_open_source_projects_js-signals_dist_js-signals.js.html">js-signals.js</a>.
</p>
@@ -126,9 +144,92 @@ <h1 class="classTitle">
<!-- ============================== field details ========================== -->
+ <div class="details">
+ <div class="sectionTitle">
+ Field Detail
+ </div>
+
+ <div class="member">
+ <a name=".VERSION"> </a>
+ <div class="fixedFont">
+ <div class="modifiers">&lt;static&gt;
+ </div>
+
+ <span class="light">{string}</span>
+ <span class="light">signals.</span><b>VERSION</b>
+
+ </div>
+ <div class="description">
+ <p>Signals Version Number</p>
+
+
+ </div>
+
+
+
+
+
+
+
+ </div>
+
+ </div>
+
<!-- ============================== method details ========================= -->
+ <div class="details">
+ <div class="sectionTitle">
+ Method Detail
+ </div>
+
+ <div class="member">
+ <a name=".isDef"> </a>
+ <div class="fixedFont">
+ <div class="modifiers">&lt;static&gt;
+ </div>
+ <span class="light">{boolean}</span>
+ <span class="light">signals.</span><b>isDef</b>(param)
+
+ </div>
+ <div class="description">
+
+
+
+ </div>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{*}</span> <b>param</b>
+
+ </dt>
+ <dd>Parameter to check.</dd>
+
+ </dl>
+
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Returns:</dt>
+
+ <dd><span class="light fixedFont">{boolean}</span> `true` if parameter is different than `undefined`.</dd>
+
+ </dl>
+
+
+
+
+ </div>
+
+ </div>
+
<!-- ============================== event details ========================= -->
@@ -139,7 +240,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both;text-align:center">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Nov 27 2010 16:19:19 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Fri Dec 03 2010 17:27:36 GMT-0500 (EST)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
View
381 ...cs/symbols/src/C__Miller_Personal_open_source_projects_js-signals_dist_js-signals.js.html
@@ -0,0 +1,381 @@
+<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
+ .KEYW {color: #933;}
+ .COMM {color: #bbb; font-style: italic;}
+ .NUMB {color: #393;}
+ .STRN {color: #393;}
+ .REGX {color: #339;}
+ .line {border-right: 1px dotted #666; color: #666; font-style: normal;}
+ </style></head><body><pre><span class='line'> 1</span> <span class="COMM">/*!!
+<span class='line'> 2</span> * JS Signals &lt;https://github.com/millermedeiros/js-signals>
+<span class='line'> 3</span> * Released under the MIT license (http://www.opensource.org/licenses/mit-license.php)
+<span class='line'> 4</span> * @author Miller Medeiros &lt;http://millermedeiros.com>
+<span class='line'> 5</span> * @version 0.5
+<span class='line'> 6</span> * @build 100 12/03/2010 05:27 PM
+<span class='line'> 7</span> */</span><span class="WHIT">
+<span class='line'> 8</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 11</span> * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
+<span class='line'> 12</span> * @name signals
+<span class='line'> 13</span> */</span><span class="WHIT">
+<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">signals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.signals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 17</span> * Signals Version Number
+<span class='line'> 18</span> * @type string
+<span class='line'> 19</span> * @const
+<span class='line'> 20</span> */</span><span class="WHIT">
+<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">signals.VERSION</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'0.5'</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 24</span> * @param {*} param Parameter to check.
+<span class='line'> 25</span> * @return {boolean} `true` if parameter is different than `undefined`.
+<span class='line'> 26</span> */</span><span class="WHIT">
+<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="NAME">signals.isDef</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">param</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 30</span>
+<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 32</span> * Signal - custom event broadcaster
+<span class='line'> 33</span> * &lt;br />- inspired by Robert Penner's AS3 Signals.
+<span class='line'> 34</span> * @author Miller Medeiros
+<span class='line'> 35</span> * @constructor
+<span class='line'> 36</span> */</span><span class="WHIT">
+<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="NAME">signals.Signal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 39</span> * @type Array.&lt;signals.SignalBinding>
+<span class='line'> 40</span> * @private
+<span class='line'> 41</span> */</span><span class="WHIT">
+<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">this._bindings</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="NAME">signals.Signal.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 49</span> * @type boolean
+<span class='line'> 50</span> * @private
+<span class='line'> 51</span> */</span><span class="WHIT">
+<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="NAME">_shouldPropagate</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 55</span> * @type boolean
+<span class='line'> 56</span> * @private
+<span class='line'> 57</span> */</span><span class="WHIT">
+<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="NAME">_isEnabled</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 61</span> * @param {Function} listener
+<span class='line'> 62</span> * @param {boolean} isOnce
+<span class='line'> 63</span> * @param {Object} [scope]
+<span class='line'> 64</span> * @return {signals.SignalBinding}
+<span class='line'> 65</span> * @private
+<span class='line'> 66</span> */</span><span class="WHIT">
+<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">_registerListener</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isOnce</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">signals.isDef</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">'listener is a required param of add() and addOnce().'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prevIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._indexOfListener</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="NAME">binding</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">prevIndex</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">//avoid creating a new Binding for same listener if already added to list</span><span class="WHIT">
+<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="NAME">binding</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._bindings</span><span class="PUNC">[</span><span class="NAME">prevIndex</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">binding.isOnce</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">isOnce</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">'You cannot add'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isOnce</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'Once'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">'() then add'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">isOnce</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">''</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'Once'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">'() the same listener without removing the relationship first.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="NAME">binding</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">signals.SignalBinding</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">isOnce</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="NAME">this._addBinding</span><span class="PUNC">(</span><span class="NAME">binding</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">binding</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 88</span> * @param {signals.SignalBinding} binding
+<span class='line'> 89</span> * @private
+<span class='line'> 90</span> */</span><span class="WHIT">
+<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="NAME">_addBinding</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">binding</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">this._bindings.push</span><span class="PUNC">(</span><span class="NAME">binding</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 96</span> * @param {Function} listener
+<span class='line'> 97</span> * @return {int}
+<span class='line'> 98</span> * @private
+<span class='line'> 99</span> */</span><span class="WHIT">
+<span class='line'>100</span> </span><span class="WHIT"> </span><span class="NAME">_indexOfListener</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>101</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._bindings.length</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>102</span> </span><span class="WHIT"> </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">--</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>103</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._bindings</span><span class="PUNC">[</span><span class="NAME">n</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">_listener</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">listener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>104</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>105</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>106</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>107</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>108</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>109</span> * Add a listener to the signal.
+<span class='line'>110</span> * @param {Function} listener Signal handler function.
+<span class='line'>111</span> * @param {Object} [scope] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
+<span class='line'>112</span> * @return {signals.SignalBinding} An Object representing the binding between the Signal and listener.
+<span class='line'>113</span> */</span><span class="WHIT">
+<span class='line'>114</span> </span><span class="WHIT"> </span><span class="NAME">add</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>115</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._registerListener</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>116</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>117</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>118</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>119</span> * Add listener to the signal that should be removed after first execution (will be executed only once).
+<span class='line'>120</span> * @param {Function} listener Signal handler function.
+<span class='line'>121</span> * @param {Object} [scope] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
+<span class='line'>122</span> * @return {signals.SignalBinding} An Object representing the binding between the Signal and listener.
+<span class='line'>123</span> */</span><span class="WHIT">
+<span class='line'>124</span> </span><span class="WHIT"> </span><span class="NAME">addOnce</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>125</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._registerListener</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">scope</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>126</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>127</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>128</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>129</span> * @private
+<span class='line'>130</span> */</span><span class="WHIT">
+<span class='line'>131</span> </span><span class="WHIT"> </span><span class="NAME">_removeByIndex</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>132</span> </span><span class="WHIT"> </span><span class="NAME">this._bindings</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">_destroy</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//no reason to a SignalBinding exist if it isn't attached to a signal</span><span class="WHIT">
+<span class='line'>133</span> </span><span class="WHIT"> </span><span class="NAME">this._bindings.splice</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>134</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>135</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>136</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>137</span> * Remove a single listener from the dispatch queue.
+<span class='line'>138</span> * @param {Function} listener Handler function that should be removed.
+<span class='line'>139</span> * @return {Function} Listener handler function.
+<span class='line'>140</span> */</span><span class="WHIT">
+<span class='line'>141</span> </span><span class="WHIT"> </span><span class="NAME">remove</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>142</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">signals.isDef</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">'listener is a required param of remove().'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>143</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>144</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._indexOfListener</span><span class="PUNC">(</span><span class="NAME">listener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>145</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">this._removeByIndex</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>146</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">listener</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>147</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>148</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>149</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>150</span> * Remove all listeners from the Signal.
+<span class='line'>151</span> */</span><span class="WHIT">
+<span class='line'>152</span> </span><span class="WHIT"> </span><span class="NAME">removeAll</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>153</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._bindings.length</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>154</span> </span><span class="WHIT"> </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">--</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>155</span> </span><span class="WHIT"> </span><span class="NAME">this._removeByIndex</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>156</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>157</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>158</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>159</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>160</span> * @return {uint} Number of listeners attached to the Signal.
+<span class='line'>161</span> */</span><span class="WHIT">
+<span class='line'>162</span> </span><span class="WHIT"> </span><span class="NAME">getNumListeners</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>163</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._bindings.length</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>164</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>165</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>166</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>167</span> * Disable Signal, will block dispatch to listeners until `enable()` is called.
+<span class='line'>168</span> * @see signals.Signal.prototype.enable
+<span class='line'>169</span> */</span><span class="WHIT">
+<span class='line'>170</span> </span><span class="WHIT"> </span><span class="NAME">disable</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>171</span> </span><span class="WHIT"> </span><span class="NAME">this._isEnabled</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>172</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>173</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>174</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>175</span> * Enable broadcast to listeners.
+<span class='line'>176</span> * @see signals.Signal.prototype.disable
+<span class='line'>177</span> */</span><span class="WHIT">
+<span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">enable</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">this._isEnabled</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>180</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>181</span> </span><span class="WHIT"> </span><span class="WHIT">
+<span class='line'>182</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>183</span> * @return {boolean} If Signal is currently enabled and will broadcast message to listeners.
+<span class='line'>184</span> */</span><span class="WHIT">
+<span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">isEnabled</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>186</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._isEnabled</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>187</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'>188</span> </span><span class="WHIT"> </span><span class="WHIT">