Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'release-0.6.0'

  • Loading branch information...
commit 8b30133864d2d73445f49c0fb823962520c86cd1 2 parents e7f0a3c + 574bb08
Miller Medeiros authored
Showing with 1,435 additions and 1,479 deletions.
  1. +24 −1 CHANGELOG.markdown
  2. +11 −1 README.markdown
  3. +14 −6 build.xml
  4. +2 −2 dev/build/build.number
  5. +2 −1  dev/build/build.properties
  6. +5 −29 dev/src/Signal.js
  7. +5 −28 dev/src/SignalBinding.js
  8. +7 −0 dev/src/license.txt
  9. +6 −25 dev/src/signals.js
  10. +14 −0 dev/src/wrapper_amd.js
  11. +15 −0 dev/src/wrapper_closure.js
  12. +1 −1  dev/tests/coverage/coverage.json
  13. +113 −162 dev/tests/coverage/js-signals.inst.js
  14. +361 −447 ...ls.js.html → _Users_millermedeiros_Documents_Projects__open_source_js_signals_dist_js_signals.js.html}
  15. +5 −5 dev/tests/coverage/report/index.html
  16. +13 −13 dev/tests/src/01.js
  17. +2 −2 dist/docs/files.html
  18. +1 −1  dist/docs/index.html
  19. +12 −34 dist/docs/symbolindex.html
  20. +1 −1  dist/docs/symbols/_global_.html
  21. +44 −120 dist/docs/symbols/signals.Signal.html
  22. +31 −117 dist/docs/symbols/signals.SignalBinding.html
  23. +3 −3 dist/docs/symbols/signals.html
  24. +0 −409 dist/docs/symbols/src/C__Miller_Personal_open_source_projects_js-signals_dist_js-signals.js.html
  25. +363 −0 dist/docs/symbols/src/_Users_millermedeiros_Documents_Projects__open_source_js-signals_dist_js-signals.js.html
  26. +355 −0 dist/js-signals.amd.js
  27. +22 −68 dist/js-signals.js
  28. +3 −3 dist/js-signals.min.js
25 CHANGELOG.markdown
View
@@ -2,6 +2,29 @@
+## v0.6 (2011/04/09) ##
+
+### API changes ###
+
+ - Added:
+ - `Signal.active`
+ - `SignalBinding.active`
+
+ - Removed:
+ - `Signal.protytpe.enable()`
+ - `Signal.protytpe.disable()`
+ - `Signal.protytpe.isEnabled()`
+ - `SignalBinding.protytpe.enable()`
+ - `SignalBinding.protytpe.disable()`
+ - `SignalBinding.protytpe.isEnabled()`
+
+### Other ###
+
+ - created AMD wrapped version.
+ - switched from "module pattern" to a closure with a global export.
+
+
+
## v0.5.3 (2011/02/21) ##
### API changes ###
@@ -48,7 +71,7 @@
- Added:
- `SignalBinding.prototype.getListener()` (issue #3)
- - `Signal.dispose()` (issue #6)
+ - `Signal.prototype.dispose()` (issue #6)
- `signals.VERSION`
- `signals.isDef()`
12 README.markdown
View
@@ -19,6 +19,16 @@ For a more in-depth introduction read the [JS-Signals Project Page](http://mille
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
+## Distribution Files ##
+
+Files inside `dist` folder.
+
+ * docs/index.html : Documentation.
+ * js-signals.js : Uncompressed source code with comments.
+ * js-signals.amd.js : Uncompressed source code wrapped as an [asynchronous module](http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition) to be used together with [RequireJS](http://requirejs.org/).
+ * js-signals.min.js : Compressed code.
+
+
## Repository Structure ##
### Folder Structure ###
@@ -44,6 +54,6 @@ This project uses [Apache Ant](http://ant.apache.org/) for the build process. If
ant build
-This will delete all JS files inside the `dist` folder, merge/update/compress source files (`dev/src`), validate generated code using [JSLint](http://www.jslint.com/) and copy the output to the `dist` folder.
+This will delete all JS files inside the `dist` folder, merge/update/compress source files, validate generated code using [JSLint](http://www.jslint.com/) and copy the output to the `dist` folder.
**IMPORTANT:** `dist` folder always contain the latest version, regular users should **not** need to run build task.
20 build.xml
View
@@ -12,7 +12,7 @@
<target name="-purgeJsDeploy">
<delete>
- <fileset dir="${dist.dir}" includes="${dist.name} ${dist.min.name}" />
+ <fileset dir="${dist.dir}" includes="${dist.name} ${dist.min.name} ${dist.amd.name}" />
</delete>
</target>
@@ -25,20 +25,28 @@
<format property="build.date" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
- <copy file="${src.dir}/signals.js" tofile="${dist.dir}/${dist.name}" />
+ <loadfile property="license.txt" srcFile="${src.dir}/license.txt"/>
+ <loadfile property="signals.js" srcFile="${src.dir}/signals.js"/>
<loadfile property="SignalBinding.js" srcFile="${src.dir}/SignalBinding.js"/>
<loadfile property="Signal.js" srcFile="${src.dir}/Signal.js"/>
- <replace file="${dist.dir}/${dist.name}">
+ <copy file="${src.dir}/wrapper_closure.js" tofile="${dist.dir}/${dist.name}" />
+ <copy file="${src.dir}/wrapper_amd.js" tofile="${dist.dir}/${dist.amd.name}" />
+
+ <replace>
+ <fileset dir="${dist.dir}" includes="${dist.name} ${dist.amd.name}" />
+ <replacefilter token="//::LICENSE:://" value="${license.txt}" />
+ <replacefilter token="//::SIGNALS_JS:://" value="${signals.js}" />
+ <replacefilter token="//::SIGNAL_BINDING_JS:://" value="${SignalBinding.js}" />
+ <replacefilter token="//::SIGNAL_JS:://" value="${Signal.js}" />
+ <!-- version number, build number/date should come after other replaces -->
<replacefilter token="::VERSION_NUMBER::" value="${version.number}" />
<replacefilter token="::BUILD_NUMBER::" value="${build.number}" />
<replacefilter token="::BUILD_DATE::" value="${build.date}" />
- <replacefilter token="//::SIGNAL_BINDING_JS:://" value="${SignalBinding.js}" />
- <replacefilter token="//::SIGNAL_JS:://" value="${Signal.js}" />
</replace>
<echo message="${dist.name} built." />
- </target>
+ </target>
<target name="lint">
<echo message="JSLinting ${dist.name}..."/>
4 dev/build/build.number
View
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
-#Mon Feb 21 19:18:50 EST 2011
-build.number=144
+#Sat Apr 09 17:27:18 BRT 2011
+build.number=175
3  dev/build/build.properties
View
@@ -11,8 +11,9 @@ jslint.jar = ${build.dir}/jslint4java/jslint4java-1.4.6.jar
yuitest-coverage.jar = ${build.dir}/yuitest-coverage/yuitest-coverage-0.5.5.jar
yuitest-coverage-report.jar = ${build.dir}/yuitest-coverage/yuitest-coverage-report-0.5.5.jar
product.name = js-signals
-version.number = 0.5.3
+version.number = 0.6
dist.name = ${product.name}.js
+dist.amd.name = ${product.name}.amd.js
dist.min.name = ${product.name}.min.js
dist.inst.name = ${product.name}.inst.js
coverage.json = ${coverage.dir}/coverage.json
34 dev/src/Signal.js
View
@@ -26,10 +26,11 @@
_shouldPropagate : true,
/**
+ * If Signal is active and should broadcast events.
+ * <p><strong>IMPORTANT:</strong> 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.</p>
* @type boolean
- * @private
*/
- _isEnabled : true,
+ active : true,
/**
* @param {Function} listener
@@ -146,31 +147,6 @@
},
/**
- * Disable Signal. Block dispatch to listeners until `enable()` is called.
- * <p><strong>IMPORTANT:</strong> If this method is called during a dispatch it will only have effect on the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>
- * @see signals.Signal.prototype.enable
- * @see signals.Signal.prototype.halt
- */
- disable : function(){
- this._isEnabled = false;
- },
-
- /**
- * Enable broadcast to listeners.
- * @see signals.Signal.prototype.disable
- */
- enable : function(){
- this._isEnabled = true;
- },
-
- /**
- * @return {boolean} If Signal is currently enabled and will broadcast message to listeners.
- */
- isEnabled : function(){
- return this._isEnabled;
- },
-
- /**
* Stop propagation of the event, blocking the dispatch to next listeners on the queue.
* <p><strong>IMPORTANT:</strong> should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.</p>
* @see signals.Signal.prototype.disable
@@ -184,7 +160,7 @@
* @param {...*} [params] Parameters that should be passed to each handler.
*/
dispatch : function(params){
- if(! this._isEnabled){
+ if(! this.active){
return;
}
@@ -212,7 +188,7 @@
* @return {string} String representation of the object.
*/
toString : function(){
- return '[Signal isEnabled: '+ this._isEnabled +' numListeners: '+ this.getNumListeners() +']';
+ return '[Signal active: '+ this.active +' numListeners: '+ this.getNumListeners() +']';
}
};
33 dev/src/SignalBinding.js
View
@@ -35,7 +35,7 @@
* Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @memberOf signals.SignalBinding.prototype
* @name context
- * @type {Object|undefined}
+ * @type Object|undefined|null
*/
this.context = listenerContext;
@@ -57,10 +57,10 @@
SignalBinding.prototype = /** @lends signals.SignalBinding.prototype */ {
/**
+ * If binding is active and should be executed.
* @type boolean
- * @private
*/
- _isEnabled : true,
+ active : true,
/**
* Call listener passing arbitrary parameters.
@@ -70,7 +70,7 @@
*/
execute : function(paramsArr){
var r;
- if(this._isEnabled){
+ if(this.active){
r = this._listener.apply(this.context, paramsArr);
if(this._isOnce){
this.detach();
@@ -116,29 +116,6 @@
},
/**
- * Disable SignalBinding, block listener execution. Listener will only be executed after calling `enable()`.
- * @see signals.SignalBinding.enable()
- */
- disable : function(){
- this._isEnabled = false;
- },
-
- /**
- * Enable SignalBinding. Enable listener execution.
- * @see signals.SignalBinding.disable()
- */
- enable : function(){
- this._isEnabled = true;
- },
-
- /**
- * @return {boolean} If SignalBinding is currently paused and won't execute listener during dispatch.
- */
- isEnabled : function(){
- return this._isEnabled;
- },
-
- /**
* @return {boolean} If SignalBinding will only be executed once.
*/
isOnce : function(){
@@ -149,7 +126,7 @@
* @return {string} String representation of the object.
*/
toString : function(){
- return '[SignalBinding isOnce: '+ this._isOnce +', isEnabled: '+ this._isEnabled +']';
+ return '[SignalBinding isOnce: '+ this._isOnce +', active: '+ this.active +']';
}
};
7 dev/src/license.txt
View
@@ -0,0 +1,7 @@
+/*!!
+ * JS Signals <http://millermedeiros.github.com/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::)
+ */
31 dev/src/signals.js
View
@@ -1,31 +1,12 @@
-/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */
-
-/*!!
- * JS Signals <http://millermedeiros.github.com/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::)
- */
-
-/**
- * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
- */
-var signals = (function(){
-
+ /**
+ * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
+ * @name signals
+ */
var signals = /** @lends signals */{
/**
* Signals Version Number
- * @type string
+ * @type String
* @const
*/
VERSION : '::VERSION_NUMBER::'
- };
-
-//::SIGNAL_BINDING_JS:://
-
-//::SIGNAL_JS:://
-
- return signals;
-
-}());
+ };
14 dev/src/wrapper_amd.js
View
@@ -0,0 +1,14 @@
+/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */
+/*global define:false*/
+
+//::LICENSE:://
+define(function(){
+
+//::SIGNALS_JS:://
+
+//::SIGNAL_BINDING_JS:://
+
+//::SIGNAL_JS:://
+
+ return signals;
+});
15 dev/src/wrapper_closure.js
View
@@ -0,0 +1,15 @@
+/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */
+/*global window:false, global:false*/
+
+//::LICENSE:://
+(function(global){
+
+//::SIGNALS_JS:://
+
+//::SIGNAL_BINDING_JS:://
+
+//::SIGNAL_JS:://
+
+ global.signals = signals;
+
+}(window || global || this));
2  dev/tests/coverage/coverage.json
View
@@ -1 +1 @@
-{"C:MillerPersonalopen_source_projectsjs-signalsdistjs-signals.js":{"lines":{"14":1,"16":1,"42":1,"49":126,"56":126,"64":126,"71":126,"78":126,"81":1,"96":91,"97":91,"98":90,"99":90,"100":23,"103":91,"112":25,"119":8,"127":1,"128":1,"136":59,"137":59,"138":59,"139":59,"147":1,"155":1,"162":3,"169":16,"176":0,"192":1,"197":75,"200":1,"224":135,"225":2,"228":133,"231":132,"232":6,"233":6,"234":2,"237":126,"238":126,"241":130,"250":126,"251":126,"252":126,"261":175,"262":173,"263":122,"264":41,"267":132,"278":87,"289":48,"298":43,"299":1,"302":42,"303":41,"304":35,"305":35,"307":41,"314":8,"315":8,"316":23,"318":8,"325":40,"335":1,"343":1,"350":6,"359":2,"367":72,"368":1,"371":71,"375":70,"379":70,"387":4,"388":4,"395":0,"400":1},"functions":{"SignalBinding:42":126,"execute:95":91,"detach:111":25,"getListener:118":8,"dispose:126":1,"_destroy:135":59,"disable:146":1,"enable:154":1,"isEnabled:161":3,"isOnce:168":16,"toString:175":0,"Signal:192":75,"_registerListener:222":135,"_addBinding:248":126,"_indexOfListener:260":175,"add:277":87,"addOnce:288":48,"remove:297":43,"removeAll:313":8,"getNumListeners:324":40,"disable:334":1,"enable:342":1,"isEnabled:349":6,"halt:358":2,"dispatch:366":72,"dispose:386":4,"toString:394":0,"(anonymous 1):14":1},"coveredLines":76,"calledLines":74,"coveredFunctions":28,"calledFunctions":26,"path":"C:\\Miller\\Personal\\open_source_projects\\js-signals\\dist\\js-signals.js","code":["/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */","","/*!!"," * JS Signals <http://millermedeiros.github.com/js-signals/>"," * Released under the MIT license <http://www.opensource.org/licenses/mit-license.php>"," * @author Miller Medeiros <http://millermedeiros.com/>"," * @version 0.5.2"," * @build 142 (02/21/2011 06:05 PM)"," */","","/**"," * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals"," */","var signals = (function(){","\u0009","\u0009var signals = /** @lends signals */{","\u0009\u0009/**","\u0009\u0009 * Signals Version Number","\u0009\u0009 * @type string","\u0009\u0009 * @const","\u0009\u0009 */","\u0009\u0009VERSION : '0.5.2'","\u0009};","","\u0009// SignalBinding -------------------------------------------------","\u0009//================================================================","\u0009","\u0009/**","\u0009 * Object that represents a binding between a Signal and a listener function.","\u0009 * <br />- <strong>This is an internal constructor and shouldn't be called by regular users.</strong>","\u0009 * <br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.","\u0009 * @author Miller Medeiros","\u0009 * @constructor","\u0009 * @internal","\u0009 * @name signals.SignalBinding","\u0009 * @param {signals.Signal} signal\u0009Reference to Signal object that listener is currently bound to.","\u0009 * @param {Function} listener\u0009Handler function bound to the signal.","\u0009 * @param {boolean} isOnce\u0009If binding should be executed just once.","\u0009 * @param {Object} [listenerContext]\u0009Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009 * @param {Number} [priority]\u0009The priority level of the event listener. (default = 0).","\u0009 */","\u0009 function SignalBinding(signal, listener, isOnce, listenerContext, priority){","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Handler function bound to the signal.","\u0009\u0009 * @type Function","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._listener = listener;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * If binding should be executed just once.","\u0009\u0009 * @type boolean","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._isOnce = isOnce;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009\u0009 * @memberOf signals.SignalBinding.prototype","\u0009\u0009 * @name context","\u0009\u0009 * @type {Object|undefined}","\u0009\u0009 */","\u0009\u0009this.context = listenerContext;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Reference to Signal object that listener is currently bound to.","\u0009\u0009 * @type signals.Signal","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._signal = signal;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Listener priority","\u0009\u0009 * @type Number","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._priority = priority || 0;","\u0009}","\u0009","\u0009SignalBinding.prototype = /** @lends signals.SignalBinding.prototype */ {","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @type boolean","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_isEnabled : true,","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Call listener passing arbitrary parameters.","\u0009\u0009 * <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> ","\u0009\u0009 * @param {Array} [paramsArr]\u0009Array of parameters that should be passed to the listener","\u0009\u0009 * @return {*} Value returned by the listener.","\u0009\u0009 */","\u0009\u0009execute : function(paramsArr){","\u0009\u0009\u0009var r;","\u0009\u0009\u0009if(this._isEnabled){","\u0009\u0009\u0009\u0009r = this._listener.apply(this.context, paramsArr);","\u0009\u0009\u0009\u0009if(this._isOnce){","\u0009\u0009\u0009\u0009\u0009this.detach();","\u0009\u0009\u0009\u0009}","\u0009\u0009\u0009}","\u0009\u0009\u0009return r;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Detach binding from signal.","\u0009\u0009 * - alias to: mySignal.remove(myBinding.getListener());","\u0009\u0009 * @return {Function} Handler function bound to the signal.","\u0009\u0009 */","\u0009\u0009detach : function(){","\u0009\u0009\u0009return this._signal.remove(this._listener);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {Function} Handler function bound to the signal.","\u0009\u0009 */","\u0009\u0009getListener : function(){","\u0009\u0009\u0009return this._listener;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove binding from signal and destroy any reference to external Objects (destroy SignalBinding object).","\u0009\u0009 * <p><strong>IMPORTANT:</strong> calling methods on the binding instance after calling dispose will throw errors.</p>","\u0009\u0009 */","\u0009\u0009dispose : function(){","\u0009\u0009\u0009this.detach();","\u0009\u0009\u0009this._destroy();","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Delete all instance properties","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_destroy : function(){","\u0009\u0009\u0009delete this._signal;","\u0009\u0009\u0009delete this._isOnce;","\u0009\u0009\u0009delete this._listener;","\u0009\u0009\u0009delete this.context;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Disable SignalBinding, block listener execution. Listener will only be executed after calling `enable()`. ","\u0009\u0009 * @see signals.SignalBinding.enable()","\u0009\u0009 */","\u0009\u0009disable : function(){","\u0009\u0009\u0009this._isEnabled = false;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Enable SignalBinding. Enable listener execution.","\u0009\u0009 * @see signals.SignalBinding.disable()","\u0009\u0009 */","\u0009\u0009enable : function(){","\u0009\u0009\u0009this._isEnabled = true;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {boolean} If SignalBinding is currently paused and won't execute listener during dispatch.","\u0009\u0009 */","\u0009\u0009isEnabled : function(){","\u0009\u0009\u0009return this._isEnabled;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {boolean} If SignalBinding will only be executed once.","\u0009\u0009 */","\u0009\u0009isOnce : function(){","\u0009\u0009\u0009return this._isOnce;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {string} String representation of the object.","\u0009\u0009 */","\u0009\u0009toString : function(){","\u0009\u0009\u0009return '[SignalBinding isOnce: '+ this._isOnce +', isEnabled: '+ this._isEnabled +']';","\u0009\u0009}","\u0009\u0009","\u0009};","","/*global signals:true, SignalBinding:true*/","\u0009","\u0009// Signal --------------------------------------------------------","\u0009//================================================================","\u0009","\u0009/**","\u0009 * Custom event broadcaster","\u0009 * <br />- inspired by Robert Penner's AS3 Signals.","\u0009 * @author Miller Medeiros","\u0009 * @constructor","\u0009 */","\u0009signals.Signal = function(){","\u0009\u0009/**","\u0009\u0009 * @type Array.<SignalBinding>","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._bindings = [];","\u0009};","\u0009","\u0009signals.Signal.prototype = {","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @type boolean","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_shouldPropagate : true,","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @type boolean","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_isEnabled : true,","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @param {Function} listener","\u0009\u0009 * @param {boolean} isOnce","\u0009\u0009 * @param {Object} [scope]","\u0009\u0009 * @param {Number} [priority]","\u0009\u0009 * @return {SignalBinding}","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_registerListener : function(listener, isOnce, scope, priority){","\u0009\u0009\u0009","\u0009\u0009\u0009if(typeof listener !== 'function'){","\u0009\u0009\u0009\u0009throw new Error('listener is a required param of add() and addOnce() and should be a Function.');","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009var prevIndex = this._indexOfListener(listener),","\u0009\u0009\u0009\u0009binding;","\u0009\u0009\u0009","\u0009\u0009\u0009if(prevIndex !== -1){ //avoid creating a new Binding for same listener if already added to list","\u0009\u0009\u0009\u0009binding = this._bindings[prevIndex];","\u0009\u0009\u0009\u0009if(binding.isOnce() !== isOnce){","\u0009\u0009\u0009\u0009\u0009throw new Error('You cannot add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.');","\u0009\u0009\u0009\u0009}","\u0009\u0009\u0009} else {","\u0009\u0009\u0009\u0009binding = new SignalBinding(this, listener, isOnce, scope, priority);","\u0009\u0009\u0009\u0009this._addBinding(binding);","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009return binding;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @param {Function} binding","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_addBinding : function(binding){","\u0009\u0009\u0009//simplified insertion sort","\u0009\u0009\u0009var n = this._bindings.length;","\u0009\u0009\u0009do { --n; } while (this._bindings[n] && binding._priority <= this._bindings[n]._priority);","\u0009\u0009\u0009this._bindings.splice(n+1, 0, binding);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @param {Function} listener","\u0009\u0009 * @return {number}","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_indexOfListener : function(listener){","\u0009\u0009\u0009var n = this._bindings.length;","\u0009\u0009\u0009while(n--){","\u0009\u0009\u0009\u0009if(this._bindings[n]._listener === listener){","\u0009\u0009\u0009\u0009\u0009return n;","\u0009\u0009\u0009\u0009}","\u0009\u0009\u0009}","\u0009\u0009\u0009return -1;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Add a listener to the signal.","\u0009\u0009 * @param {Function} listener\u0009Signal handler function.","\u0009\u0009 * @param {Object} [scope]\u0009Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009\u0009 * @param {Number} [priority]\u0009The 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)","\u0009\u0009 * @return {SignalBinding} An Object representing the binding between the Signal and listener.","\u0009\u0009 */","\u0009\u0009add : function(listener, scope, priority){","\u0009\u0009\u0009return this._registerListener(listener, false, scope, priority);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Add listener to the signal that should be removed after first execution (will be executed only once).","\u0009\u0009 * @param {Function} listener\u0009Signal handler function.","\u0009\u0009 * @param {Object} [scope]\u0009Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009\u0009 * @param {Number} [priority]\u0009The 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)","\u0009\u0009 * @return {SignalBinding} An Object representing the binding between the Signal and listener.","\u0009\u0009 */","\u0009\u0009addOnce : function(listener, scope, priority){","\u0009\u0009\u0009return this._registerListener(listener, true, scope, priority);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove a single listener from the dispatch queue.","\u0009\u0009 * @param {Function} listener\u0009Handler function that should be removed.","\u0009\u0009 * @return {Function} Listener handler function.","\u0009\u0009 */","\u0009\u0009remove : function(listener){","\u0009\u0009\u0009if(typeof listener !== 'function'){","\u0009\u0009\u0009\u0009throw new Error('listener is a required param of remove() and should be a Function.');","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009var i = this._indexOfListener(listener);","\u0009\u0009\u0009if(i !== -1){","\u0009\u0009\u0009\u0009this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal","\u0009\u0009\u0009\u0009this._bindings.splice(i, 1);","\u0009\u0009\u0009}","\u0009\u0009\u0009return listener;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove all listeners from the Signal.","\u0009\u0009 */","\u0009\u0009removeAll : function(){","\u0009\u0009\u0009var n = this._bindings.length;","\u0009\u0009\u0009while(n--){","\u0009\u0009\u0009\u0009this._bindings[n]._destroy();","\u0009\u0009\u0009}","\u0009\u0009\u0009this._bindings.length = 0;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {number} Number of listeners attached to the Signal.","\u0009\u0009 */","\u0009\u0009getNumListeners : function(){","\u0009\u0009\u0009return this._bindings.length;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Disable Signal. Block dispatch to listeners until `enable()` is called.","\u0009\u0009 * <p><strong>IMPORTANT:</strong> If this method is called during a dispatch it will only have effect on the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>","\u0009\u0009 * @see signals.Signal.prototype.enable","\u0009\u0009 * @see signals.Signal.prototype.halt","\u0009\u0009 */","\u0009\u0009disable : function(){","\u0009\u0009\u0009this._isEnabled = false;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Enable broadcast to listeners.","\u0009\u0009 * @see signals.Signal.prototype.disable","\u0009\u0009 */","\u0009\u0009enable : function(){","\u0009\u0009\u0009this._isEnabled = true;","\u0009\u0009}, ","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {boolean} If Signal is currently enabled and will broadcast message to listeners.","\u0009\u0009 */","\u0009\u0009isEnabled : function(){","\u0009\u0009\u0009return this._isEnabled;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Stop propagation of the event, blocking the dispatch to next listeners on the queue.","\u0009\u0009 * <p><strong>IMPORTANT:</strong> should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.</p>","\u0009\u0009 * @see signals.Signal.prototype.disable ","\u0009\u0009 */","\u0009\u0009halt : function(){","\u0009\u0009\u0009this._shouldPropagate = false;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Dispatch/Broadcast Signal to all listeners added to the queue. ","\u0009\u0009 * @param {...*} [params]\u0009Parameters that should be passed to each handler.","\u0009\u0009 */","\u0009\u0009dispatch : function(params){","\u0009\u0009\u0009if(! this._isEnabled){","\u0009\u0009\u0009\u0009return;","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009var paramsArr = Array.prototype.slice.call(arguments),","\u0009\u0009\u0009\u0009bindings = this._bindings.slice(), //clone array in case add/remove items during dispatch","\u0009\u0009\u0009\u0009n = this._bindings.length;","\u0009\u0009\u0009","\u0009\u0009\u0009this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch.","\u0009\u0009\u0009","\u0009\u0009\u0009//execute all callbacks until end of the list or until a callback returns `false` or stops propagation","\u0009\u0009\u0009//reverse loop since listeners with higher priority will be added at the end of the list","\u0009\u0009\u0009do { n--; } while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove all bindings from signal and destroy any reference to external objects (destroy Signal object).","\u0009\u0009 * <p><strong>IMPORTANT:</strong> calling any method on the signal instance after calling dispose will throw errors.</p>","\u0009\u0009 */","\u0009\u0009dispose : function(){","\u0009\u0009\u0009this.removeAll();","\u0009\u0009\u0009delete this._bindings;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {string} String representation of the object.","\u0009\u0009 */","\u0009\u0009toString : function(){","\u0009\u0009\u0009return '[Signal isEnabled: '+ this._isEnabled +' numListeners: '+ this.getNumListeners() +']';","\u0009\u0009}","\u0009\u0009","\u0009};","","\u0009return signals;","\u0009","}());"]}}
+{"/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js":{"lines":{"14":1,"20":1,"46":1,"53":126,"60":126,"68":126,"75":126,"82":126,"85":1,"100":91,"101":91,"102":90,"103":90,"104":23,"107":91,"116":25,"123":8,"131":1,"132":1,"140":59,"141":59,"142":59,"143":59,"150":16,"157":0,"173":1,"178":75,"181":1,"206":135,"207":2,"210":133,"213":132,"214":6,"215":6,"216":2,"219":126,"220":126,"223":130,"232":126,"233":126,"234":126,"243":175,"244":173,"245":122,"246":41,"249":132,"260":87,"271":48,"280":43,"281":1,"284":42,"285":41,"286":35,"287":35,"289":41,"296":8,"297":8,"298":23,"300":8,"307":40,"316":2,"324":72,"325":1,"328":71,"332":70,"336":70,"344":4,"345":4,"352":0,"357":1},"functions":{"SignalBinding:46":126,"execute:99":91,"detach:115":25,"getListener:122":8,"dispose:130":1,"_destroy:139":59,"isOnce:149":16,"toString:156":0,"Signal:173":75,"_registerListener:204":135,"_addBinding:230":126,"_indexOfListener:242":175,"add:259":87,"addOnce:270":48,"remove:279":43,"removeAll:295":8,"getNumListeners:306":40,"halt:315":2,"dispatch:323":72,"dispose:343":4,"toString:351":0,"(anonymous 1):14":1},"coveredLines":70,"calledLines":68,"coveredFunctions":22,"calledFunctions":20,"path":"/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js","code":["/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */","","/*!!"," * JS Signals <http://millermedeiros.github.com/js-signals/>"," * Released under the MIT license <http://www.opensource.org/licenses/mit-license.php>"," * @author Miller Medeiros <http://millermedeiros.com/>"," * @version 0.5.4a"," * @build 170 (04/09/2011 04:54 PM)"," */","","/**"," * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals"," */","var signals = (function(){","\u0009","\u0009/**","\u0009 * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals","\u0009 * @name signals","\u0009 */","\u0009var signals = /** @lends signals */{","\u0009\u0009/**","\u0009\u0009 * Signals Version Number","\u0009\u0009 * @type String","\u0009\u0009 * @const","\u0009\u0009 */","\u0009\u0009VERSION : '0.5.4a'","\u0009};","","\u0009// SignalBinding -------------------------------------------------","\u0009//================================================================","\u0009","\u0009/**","\u0009 * Object that represents a binding between a Signal and a listener function.","\u0009 * <br />- <strong>This is an internal constructor and shouldn't be called by regular users.</strong>","\u0009 * <br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.","\u0009 * @author Miller Medeiros","\u0009 * @constructor","\u0009 * @internal","\u0009 * @name signals.SignalBinding","\u0009 * @param {signals.Signal} signal\u0009Reference to Signal object that listener is currently bound to.","\u0009 * @param {Function} listener\u0009Handler function bound to the signal.","\u0009 * @param {boolean} isOnce\u0009If binding should be executed just once.","\u0009 * @param {Object} [listenerContext]\u0009Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009 * @param {Number} [priority]\u0009The priority level of the event listener. (default = 0).","\u0009 */","\u0009 function SignalBinding(signal, listener, isOnce, listenerContext, priority){","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Handler function bound to the signal.","\u0009\u0009 * @type Function","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._listener = listener;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * If binding should be executed just once.","\u0009\u0009 * @type boolean","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._isOnce = isOnce;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009\u0009 * @memberOf signals.SignalBinding.prototype","\u0009\u0009 * @name context","\u0009\u0009 * @type Object|undefined|null","\u0009\u0009 */","\u0009\u0009this.context = listenerContext;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Reference to Signal object that listener is currently bound to.","\u0009\u0009 * @type signals.Signal","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._signal = signal;","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Listener priority","\u0009\u0009 * @type Number","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._priority = priority || 0;","\u0009}","\u0009","\u0009SignalBinding.prototype = /** @lends signals.SignalBinding.prototype */ {","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * If binding is active and should be executed.","\u0009\u0009 * @type boolean","\u0009\u0009 */","\u0009\u0009active : true,","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Call listener passing arbitrary parameters.","\u0009\u0009 * <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> ","\u0009\u0009 * @param {Array} [paramsArr]\u0009Array of parameters that should be passed to the listener","\u0009\u0009 * @return {*} Value returned by the listener.","\u0009\u0009 */","\u0009\u0009execute : function(paramsArr){","\u0009\u0009\u0009var r;","\u0009\u0009\u0009if(this.active){","\u0009\u0009\u0009\u0009r = this._listener.apply(this.context, paramsArr);","\u0009\u0009\u0009\u0009if(this._isOnce){","\u0009\u0009\u0009\u0009\u0009this.detach();","\u0009\u0009\u0009\u0009}","\u0009\u0009\u0009}","\u0009\u0009\u0009return r;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Detach binding from signal.","\u0009\u0009 * - alias to: mySignal.remove(myBinding.getListener());","\u0009\u0009 * @return {Function} Handler function bound to the signal.","\u0009\u0009 */","\u0009\u0009detach : function(){","\u0009\u0009\u0009return this._signal.remove(this._listener);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {Function} Handler function bound to the signal.","\u0009\u0009 */","\u0009\u0009getListener : function(){","\u0009\u0009\u0009return this._listener;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove binding from signal and destroy any reference to external Objects (destroy SignalBinding object).","\u0009\u0009 * <p><strong>IMPORTANT:</strong> calling methods on the binding instance after calling dispose will throw errors.</p>","\u0009\u0009 */","\u0009\u0009dispose : function(){","\u0009\u0009\u0009this.detach();","\u0009\u0009\u0009this._destroy();","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Delete all instance properties","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_destroy : function(){","\u0009\u0009\u0009delete this._signal;","\u0009\u0009\u0009delete this._isOnce;","\u0009\u0009\u0009delete this._listener;","\u0009\u0009\u0009delete this.context;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {boolean} If SignalBinding will only be executed once.","\u0009\u0009 */","\u0009\u0009isOnce : function(){","\u0009\u0009\u0009return this._isOnce;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {string} String representation of the object.","\u0009\u0009 */","\u0009\u0009toString : function(){","\u0009\u0009\u0009return '[SignalBinding isOnce: '+ this._isOnce +', active: '+ this.active +']';","\u0009\u0009}","\u0009\u0009","\u0009};","","/*global signals:true, SignalBinding:true*/","\u0009","\u0009// Signal --------------------------------------------------------","\u0009//================================================================","\u0009","\u0009/**","\u0009 * Custom event broadcaster","\u0009 * <br />- inspired by Robert Penner's AS3 Signals.","\u0009 * @author Miller Medeiros","\u0009 * @constructor","\u0009 */","\u0009signals.Signal = function(){","\u0009\u0009/**","\u0009\u0009 * @type Array.<SignalBinding>","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009this._bindings = [];","\u0009};","\u0009","\u0009signals.Signal.prototype = {","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @type boolean","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_shouldPropagate : true,","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * If Signal is active and should broadcast events.","\u0009\u0009 * <p><strong>IMPORTANT:</strong> 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.</p>","\u0009\u0009 * @type boolean","\u0009\u0009 */","\u0009\u0009active : true,","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @param {Function} listener","\u0009\u0009 * @param {boolean} isOnce","\u0009\u0009 * @param {Object} [scope]","\u0009\u0009 * @param {Number} [priority]","\u0009\u0009 * @return {SignalBinding}","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_registerListener : function(listener, isOnce, scope, priority){","\u0009\u0009\u0009","\u0009\u0009\u0009if(typeof listener !== 'function'){","\u0009\u0009\u0009\u0009throw new Error('listener is a required param of add() and addOnce() and should be a Function.');","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009var prevIndex = this._indexOfListener(listener),","\u0009\u0009\u0009\u0009binding;","\u0009\u0009\u0009","\u0009\u0009\u0009if(prevIndex !== -1){ //avoid creating a new Binding for same listener if already added to list","\u0009\u0009\u0009\u0009binding = this._bindings[prevIndex];","\u0009\u0009\u0009\u0009if(binding.isOnce() !== isOnce){","\u0009\u0009\u0009\u0009\u0009throw new Error('You cannot add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.');","\u0009\u0009\u0009\u0009}","\u0009\u0009\u0009} else {","\u0009\u0009\u0009\u0009binding = new SignalBinding(this, listener, isOnce, scope, priority);","\u0009\u0009\u0009\u0009this._addBinding(binding);","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009return binding;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @param {Function} binding","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_addBinding : function(binding){","\u0009\u0009\u0009//simplified insertion sort","\u0009\u0009\u0009var n = this._bindings.length;","\u0009\u0009\u0009do { --n; } while (this._bindings[n] && binding._priority <= this._bindings[n]._priority);","\u0009\u0009\u0009this._bindings.splice(n+1, 0, binding);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @param {Function} listener","\u0009\u0009 * @return {number}","\u0009\u0009 * @private","\u0009\u0009 */","\u0009\u0009_indexOfListener : function(listener){","\u0009\u0009\u0009var n = this._bindings.length;","\u0009\u0009\u0009while(n--){","\u0009\u0009\u0009\u0009if(this._bindings[n]._listener === listener){","\u0009\u0009\u0009\u0009\u0009return n;","\u0009\u0009\u0009\u0009}","\u0009\u0009\u0009}","\u0009\u0009\u0009return -1;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Add a listener to the signal.","\u0009\u0009 * @param {Function} listener\u0009Signal handler function.","\u0009\u0009 * @param {Object} [scope]\u0009Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009\u0009 * @param {Number} [priority]\u0009The 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)","\u0009\u0009 * @return {SignalBinding} An Object representing the binding between the Signal and listener.","\u0009\u0009 */","\u0009\u0009add : function(listener, scope, priority){","\u0009\u0009\u0009return this._registerListener(listener, false, scope, priority);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Add listener to the signal that should be removed after first execution (will be executed only once).","\u0009\u0009 * @param {Function} listener\u0009Signal handler function.","\u0009\u0009 * @param {Object} [scope]\u0009Context on which listener will be executed (object that should represent the `this` variable inside listener function).","\u0009\u0009 * @param {Number} [priority]\u0009The 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)","\u0009\u0009 * @return {SignalBinding} An Object representing the binding between the Signal and listener.","\u0009\u0009 */","\u0009\u0009addOnce : function(listener, scope, priority){","\u0009\u0009\u0009return this._registerListener(listener, true, scope, priority);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove a single listener from the dispatch queue.","\u0009\u0009 * @param {Function} listener\u0009Handler function that should be removed.","\u0009\u0009 * @return {Function} Listener handler function.","\u0009\u0009 */","\u0009\u0009remove : function(listener){","\u0009\u0009\u0009if(typeof listener !== 'function'){","\u0009\u0009\u0009\u0009throw new Error('listener is a required param of remove() and should be a Function.');","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009var i = this._indexOfListener(listener);","\u0009\u0009\u0009if(i !== -1){","\u0009\u0009\u0009\u0009this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal","\u0009\u0009\u0009\u0009this._bindings.splice(i, 1);","\u0009\u0009\u0009}","\u0009\u0009\u0009return listener;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove all listeners from the Signal.","\u0009\u0009 */","\u0009\u0009removeAll : function(){","\u0009\u0009\u0009var n = this._bindings.length;","\u0009\u0009\u0009while(n--){","\u0009\u0009\u0009\u0009this._bindings[n]._destroy();","\u0009\u0009\u0009}","\u0009\u0009\u0009this._bindings.length = 0;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {number} Number of listeners attached to the Signal.","\u0009\u0009 */","\u0009\u0009getNumListeners : function(){","\u0009\u0009\u0009return this._bindings.length;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Stop propagation of the event, blocking the dispatch to next listeners on the queue.","\u0009\u0009 * <p><strong>IMPORTANT:</strong> should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.</p>","\u0009\u0009 * @see signals.Signal.prototype.disable ","\u0009\u0009 */","\u0009\u0009halt : function(){","\u0009\u0009\u0009this._shouldPropagate = false;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Dispatch/Broadcast Signal to all listeners added to the queue. ","\u0009\u0009 * @param {...*} [params]\u0009Parameters that should be passed to each handler.","\u0009\u0009 */","\u0009\u0009dispatch : function(params){","\u0009\u0009\u0009if(! this.active){","\u0009\u0009\u0009\u0009return;","\u0009\u0009\u0009}","\u0009\u0009\u0009","\u0009\u0009\u0009var paramsArr = Array.prototype.slice.call(arguments),","\u0009\u0009\u0009\u0009bindings = this._bindings.slice(), //clone array in case add/remove items during dispatch","\u0009\u0009\u0009\u0009n = this._bindings.length;","\u0009\u0009\u0009","\u0009\u0009\u0009this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch.","\u0009\u0009\u0009","\u0009\u0009\u0009//execute all callbacks until end of the list or until a callback returns `false` or stops propagation","\u0009\u0009\u0009//reverse loop since listeners with higher priority will be added at the end of the list","\u0009\u0009\u0009do { n--; } while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false);","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * Remove all bindings from signal and destroy any reference to external objects (destroy Signal object).","\u0009\u0009 * <p><strong>IMPORTANT:</strong> calling any method on the signal instance after calling dispose will throw errors.</p>","\u0009\u0009 */","\u0009\u0009dispose : function(){","\u0009\u0009\u0009this.removeAll();","\u0009\u0009\u0009delete this._bindings;","\u0009\u0009},","\u0009\u0009","\u0009\u0009/**","\u0009\u0009 * @return {string} String representation of the object.","\u0009\u0009 */","\u0009\u0009toString : function(){","\u0009\u0009\u0009return '[Signal active: '+ this.active +' numListeners: '+ this.getNumListeners() +']';","\u0009\u0009}","\u0009\u0009","\u0009};","","\u0009return signals;","\u0009","}());"]}}
275 dev/tests/coverage/js-signals.inst.js
View
@@ -16,44 +16,48 @@ if (typeof _yuitest_coverage == "undefined"){
coverage.functions[funcId]++;
};
}
-_yuitest_coverage["C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js"] = {
+_yuitest_coverage["/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js"] = {
lines: {},
functions: {},
coveredLines: 0,
calledLines: 0,
coveredFunctions: 0,
calledFunctions: 0,
- path: "C:\\Miller\\Personal\\open_source_projects\\js-signals\\dist\\js-signals.js",
+ path: "/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js",
code: []
};
-_yuitest_coverage["C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js"].code=["/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */","","/*!!"," * JS Signals <http://millermedeiros.github.com/js-signals/>"," * Released under the MIT license <http://www.opensource.org/licenses/mit-license.php>"," * @author Miller Medeiros <http://millermedeiros.com/>"," * @version 0.5.2"," * @build 142 (02/21/2011 06:05 PM)"," */","","/**"," * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals"," */","var signals = (function(){"," "," var signals = /** @lends signals */{"," /**"," * Signals Version Number"," * @type string"," * @const"," */"," VERSION : '0.5.2'"," };",""," // SignalBinding -------------------------------------------------"," //================================================================"," "," /**"," * Object that represents a binding between a Signal and a listener function."," * <br />- <strong>This is an internal constructor and shouldn't be called by regular users.</strong>"," * <br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes."," * @author Miller Medeiros"," * @constructor"," * @internal"," * @name signals.SignalBinding"," * @param {signals.Signal} signal Reference to Signal object that listener is currently bound to."," * @param {Function} listener Handler function bound to the signal."," * @param {boolean} isOnce If binding should be executed just once."," * @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function)."," * @param {Number} [priority] The priority level of the event listener. (default = 0)."," */"," function SignalBinding(signal, listener, isOnce, listenerContext, priority){"," "," /**"," * Handler function bound to the signal."," * @type Function"," * @private"," */"," this._listener = listener;"," "," /**"," * If binding should be executed just once."," * @type boolean"," * @private"," */"," this._isOnce = isOnce;"," "," /**"," * Context on which listener will be executed (object that should represent the `this` variable inside listener function)."," * @memberOf signals.SignalBinding.prototype"," * @name context"," * @type {Object|undefined}"," */"," this.context = listenerContext;"," "," /**"," * Reference to Signal object that listener is currently bound to."," * @type signals.Signal"," * @private"," */"," this._signal = signal;"," "," /**"," * Listener priority"," * @type Number"," * @private"," */"," this._priority = priority || 0;"," }"," "," SignalBinding.prototype = /** @lends signals.SignalBinding.prototype */ {"," "," /**"," * @type boolean"," * @private"," */"," _isEnabled : true,"," "," /**"," * 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"," * @return {*} Value returned by the listener."," */"," execute : function(paramsArr){"," var r;"," if(this._isEnabled){"," r = this._listener.apply(this.context, paramsArr);"," if(this._isOnce){"," this.detach();"," }"," }"," return r;"," },"," "," /**"," * Detach binding from 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."," */"," getListener : function(){"," return this._listener;"," },"," "," /**"," * Remove binding from signal and destroy any reference to external Objects (destroy SignalBinding object)."," * <p><strong>IMPORTANT:</strong> calling methods on the binding instance after calling dispose will throw errors.</p>"," */"," dispose : function(){"," this.detach();"," this._destroy();"," },"," "," /**"," * Delete all instance properties"," * @private"," */"," _destroy : function(){"," delete this._signal;"," 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(){"," this._isEnabled = false;"," },"," "," /**"," * Enable SignalBinding. Enable listener execution."," * @see signals.SignalBinding.disable()"," */"," enable : function(){"," this._isEnabled = true;"," },"," "," /**"," * @return {boolean} If SignalBinding is currently paused and won't execute listener during dispatch."," */"," isEnabled : function(){"," return this._isEnabled;"," },"," "," /**"," * @return {boolean} If SignalBinding will only be executed once."," */"," isOnce : function(){"," return this._isOnce;"," },"," "," /**"," * @return {string} String representation of the object."," */"," toString : function(){"," return '[SignalBinding isOnce: '+ this._isOnce +', isEnabled: '+ this._isEnabled +']';"," }"," "," };","","/*global signals:true, SignalBinding:true*/"," "," // Signal --------------------------------------------------------"," //================================================================"," "," /**"," * Custom event broadcaster"," * <br />- inspired by Robert Penner's AS3 Signals."," * @author Miller Medeiros"," * @constructor"," */"," signals.Signal = function(){"," /**"," * @type Array.<SignalBinding>"," * @private"," */"," this._bindings = [];"," };"," "," signals.Signal.prototype = {"," "," /**"," * @type boolean"," * @private"," */"," _shouldPropagate : true,"," "," /**"," * @type boolean"," * @private"," */"," _isEnabled : true,"," "," /**"," * @param {Function} listener"," * @param {boolean} isOnce"," * @param {Object} [scope]"," * @param {Number} [priority]"," * @return {SignalBinding}"," * @private"," */"," _registerListener : function(listener, isOnce, scope, priority){"," "," if(typeof listener !== 'function'){"," throw new Error('listener is a required param of add() and addOnce() and should be a Function.');"," }"," "," 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 add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.');"," }"," } else {"," binding = new SignalBinding(this, listener, isOnce, scope, priority);"," this._addBinding(binding);"," }"," "," return binding;"," },"," "," /**"," * @param {Function} binding"," * @private"," */"," _addBinding : function(binding){"," //simplified insertion sort"," var n = this._bindings.length;"," do { --n; } while (this._bindings[n] && binding._priority <= this._bindings[n]._priority);"," this._bindings.splice(n+1, 0, binding);"," },"," "," /**"," * @param {Function} listener"," * @return {number}"," * @private"," */"," _indexOfListener : function(listener){"," var n = this._bindings.length;"," while(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 {Number} [priority] 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)"," * @return {SignalBinding} An Object representing the binding between the Signal and listener."," */"," add : function(listener, scope, priority){"," return this._registerListener(listener, false, scope, priority);"," },"," "," /**"," * 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 {Number} [priority] 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)"," * @return {SignalBinding} An Object representing the binding between the Signal and listener."," */"," addOnce : function(listener, scope, priority){"," return this._registerListener(listener, true, scope, priority);"," },"," "," /**"," * Remove a single listener from the dispatch queue."," * @param {Function} listener Handler function that should be removed."," * @return {Function} Listener handler function."," */"," remove : function(listener){"," if(typeof listener !== 'function'){"," throw new Error('listener is a required param of remove() and should be a Function.');"," }"," "," var i = this._indexOfListener(listener);"," if(i !== -1){"," this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal"," this._bindings.splice(i, 1);"," }"," return listener;"," },"," "," /**"," * Remove all listeners from the Signal."," */"," removeAll : function(){"," var n = this._bindings.length;"," while(n--){"," this._bindings[n]._destroy();"," }"," this._bindings.length = 0;"," },"," "," /**"," * @return {number} Number of listeners attached to the Signal."," */"," getNumListeners : function(){"," return this._bindings.length;"," },"," "," /**"," * Disable Signal. Block dispatch to listeners until `enable()` is called."," * <p><strong>IMPORTANT:</strong> If this method is called during a dispatch it will only have effect on the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>"," * @see signals.Signal.prototype.enable"," * @see signals.Signal.prototype.halt"," */"," disable : function(){"," this._isEnabled = false;"," },"," "," /**"," * Enable broadcast to listeners."," * @see signals.Signal.prototype.disable"," */"," enable : function(){"," this._isEnabled = true;"," }, "," "," /**"," * @return {boolean} If Signal is currently enabled and will broadcast message to listeners."," */"," isEnabled : function(){"," return this._isEnabled;"," },"," "," /**"," * Stop propagation of the event, blocking the dispatch to next listeners on the queue."," * <p><strong>IMPORTANT:</strong> should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.</p>"," * @see signals.Signal.prototype.disable "," */"," 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."," */"," dispatch : function(params){"," if(! this._isEnabled){"," return;"," }"," "," var paramsArr = Array.prototype.slice.call(arguments),"," bindings = this._bindings.slice(), //clone array in case add/remove items during dispatch"," n = this._bindings.length;"," "," this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch."," "," //execute all callbacks until end of the list or until a callback returns `false` or stops propagation"," //reverse loop since listeners with higher priority will be added at the end of the list"," do { n--; } while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false);"," },"," "," /**"," * Remove all bindings from signal and destroy any reference to external objects (destroy Signal object)."," * <p><strong>IMPORTANT:</strong> calling any method on the signal instance after calling dispose will throw errors.</p>"," */"," dispose : function(){"," this.removeAll();"," delete this._bindings;"," },"," "," /**"," * @return {string} String representation of the object."," */"," toString : function(){"," return '[Signal isEnabled: '+ this._isEnabled +' numListeners: '+ this.getNumListeners() +']';"," }"," "," };",""," return signals;"," ","}());"];
+_yuitest_coverage["/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js"].code=["/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */","","/*!!"," * JS Signals <http://millermedeiros.github.com/js-signals/>"," * Released under the MIT license <http://www.opensource.org/licenses/mit-license.php>"," * @author Miller Medeiros <http://millermedeiros.com/>"," * @version 0.5.4a"," * @build 170 (04/09/2011 04:54 PM)"," */","","/**"," * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals"," */","var signals = (function(){"," "," /**"," * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals"," * @name signals"," */"," var signals = /** @lends signals */{"," /**"," * Signals Version Number"," * @type String"," * @const"," */"," VERSION : '0.5.4a'"," };",""," // SignalBinding -------------------------------------------------"," //================================================================"," "," /**"," * Object that represents a binding between a Signal and a listener function."," * <br />- <strong>This is an internal constructor and shouldn't be called by regular users.</strong>"," * <br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes."," * @author Miller Medeiros"," * @constructor"," * @internal"," * @name signals.SignalBinding"," * @param {signals.Signal} signal Reference to Signal object that listener is currently bound to."," * @param {Function} listener Handler function bound to the signal."," * @param {boolean} isOnce If binding should be executed just once."," * @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function)."," * @param {Number} [priority] The priority level of the event listener. (default = 0)."," */"," function SignalBinding(signal, listener, isOnce, listenerContext, priority){"," "," /**"," * Handler function bound to the signal."," * @type Function"," * @private"," */"," this._listener = listener;"," "," /**"," * If binding should be executed just once."," * @type boolean"," * @private"," */"," this._isOnce = isOnce;"," "," /**"," * Context on which listener will be executed (object that should represent the `this` variable inside listener function)."," * @memberOf signals.SignalBinding.prototype"," * @name context"," * @type Object|undefined|null"," */"," this.context = listenerContext;"," "," /**"," * Reference to Signal object that listener is currently bound to."," * @type signals.Signal"," * @private"," */"," this._signal = signal;"," "," /**"," * Listener priority"," * @type Number"," * @private"," */"," this._priority = priority || 0;"," }"," "," SignalBinding.prototype = /** @lends signals.SignalBinding.prototype */ {"," "," /**"," * If binding is active and should be executed."," * @type boolean"," */"," active : true,"," "," /**"," * 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"," * @return {*} Value returned by the listener."," */"," execute : function(paramsArr){"," var r;"," if(this.active){"," r = this._listener.apply(this.context, paramsArr);"," if(this._isOnce){"," this.detach();"," }"," }"," return r;"," },"," "," /**"," * Detach binding from 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."," */"," getListener : function(){"," return this._listener;"," },"," "," /**"," * Remove binding from signal and destroy any reference to external Objects (destroy SignalBinding object)."," * <p><strong>IMPORTANT:</strong> calling methods on the binding instance after calling dispose will throw errors.</p>"," */"," dispose : function(){"," this.detach();"," this._destroy();"," },"," "," /**"," * Delete all instance properties"," * @private"," */"," _destroy : function(){"," delete this._signal;"," delete this._isOnce;"," delete this._listener;"," delete this.context;"," },"," "," /**"," * @return {boolean} If SignalBinding will only be executed once."," */"," isOnce : function(){"," return this._isOnce;"," },"," "," /**"," * @return {string} String representation of the object."," */"," toString : function(){"," return '[SignalBinding isOnce: '+ this._isOnce +', active: '+ this.active +']';"," }"," "," };","","/*global signals:true, SignalBinding:true*/"," "," // Signal --------------------------------------------------------"," //================================================================"," "," /**"," * Custom event broadcaster"," * <br />- inspired by Robert Penner's AS3 Signals."," * @author Miller Medeiros"," * @constructor"," */"," signals.Signal = function(){"," /**"," * @type Array.<SignalBinding>"," * @private"," */"," this._bindings = [];"," };"," "," signals.Signal.prototype = {"," "," /**"," * @type boolean"," * @private"," */"," _shouldPropagate : true,"," "," /**"," * If Signal is active and should broadcast events."," * <p><strong>IMPORTANT:</strong> 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.</p>"," * @type boolean"," */"," active : true,"," "," /**"," * @param {Function} listener"," * @param {boolean} isOnce"," * @param {Object} [scope]"," * @param {Number} [priority]"," * @return {SignalBinding}"," * @private"," */"," _registerListener : function(listener, isOnce, scope, priority){"," "," if(typeof listener !== 'function'){"," throw new Error('listener is a required param of add() and addOnce() and should be a Function.');"," }"," "," 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 add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.');"," }"," } else {"," binding = new SignalBinding(this, listener, isOnce, scope, priority);"," this._addBinding(binding);"," }"," "," return binding;"," },"," "," /**"," * @param {Function} binding"," * @private"," */"," _addBinding : function(binding){"," //simplified insertion sort"," var n = this._bindings.length;"," do { --n; } while (this._bindings[n] && binding._priority <= this._bindings[n]._priority);"," this._bindings.splice(n+1, 0, binding);"," },"," "," /**"," * @param {Function} listener"," * @return {number}"," * @private"," */"," _indexOfListener : function(listener){"," var n = this._bindings.length;"," while(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 {Number} [priority] 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)"," * @return {SignalBinding} An Object representing the binding between the Signal and listener."," */"," add : function(listener, scope, priority){"," return this._registerListener(listener, false, scope, priority);"," },"," "," /**"," * 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 {Number} [priority] 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)"," * @return {SignalBinding} An Object representing the binding between the Signal and listener."," */"," addOnce : function(listener, scope, priority){"," return this._registerListener(listener, true, scope, priority);"," },"," "," /**"," * Remove a single listener from the dispatch queue."," * @param {Function} listener Handler function that should be removed."," * @return {Function} Listener handler function."," */"," remove : function(listener){"," if(typeof listener !== 'function'){"," throw new Error('listener is a required param of remove() and should be a Function.');"," }"," "," var i = this._indexOfListener(listener);"," if(i !== -1){"," this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal"," this._bindings.splice(i, 1);"," }"," return listener;"," },"," "," /**"," * Remove all listeners from the Signal."," */"," removeAll : function(){"," var n = this._bindings.length;"," while(n--){"," this._bindings[n]._destroy();"," }"," this._bindings.length = 0;"," },"," "," /**"," * @return {number} Number of listeners attached to the Signal."," */"," getNumListeners : function(){"," return this._bindings.length;"," },"," "," /**"," * Stop propagation of the event, blocking the dispatch to next listeners on the queue."," * <p><strong>IMPORTANT:</strong> should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.</p>"," * @see signals.Signal.prototype.disable "," */"," 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."," */"," dispatch : function(params){"," if(! this.active){"," return;"," }"," "," var paramsArr = Array.prototype.slice.call(arguments),"," bindings = this._bindings.slice(), //clone array in case add/remove items during dispatch"," n = this._bindings.length;"," "," this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch."," "," //execute all callbacks until end of the list or until a callback returns `false` or stops propagation"," //reverse loop since listeners with higher priority will be added at the end of the list"," do { n--; } while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false);"," },"," "," /**"," * Remove all bindings from signal and destroy any reference to external objects (destroy Signal object)."," * <p><strong>IMPORTANT:</strong> calling any method on the signal instance after calling dispose will throw errors.</p>"," */"," dispose : function(){"," this.removeAll();"," delete this._bindings;"," },"," "," /**"," * @return {string} String representation of the object."," */"," toString : function(){"," return '[Signal active: '+ this.active +' numListeners: '+ this.getNumListeners() +']';"," }"," "," };",""," return signals;"," ","}());"];
/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */
/*!!
* JS Signals <http://millermedeiros.github.com/js-signals/>
* Released under the MIT license <http://www.opensource.org/licenses/mit-license.php>
* @author Miller Medeiros <http://millermedeiros.com/>
- * @version 0.5.2
- * @build 142 (02/21/2011 06:05 PM)
+ * @version 0.5.4a
+ * @build 170 (04/09/2011 04:54 PM)
*/
/**
* @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
*/
-_yuitest_coverage["C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js"].lines = {"14":0,"16":0,"42":0,"49":0,"56":0,"64":0,"71":0,"78":0,"81":0,"96":0,"97":0,"98":0,"99":0,"100":0,"103":0,"112":0,"119":0,"127":0,"128":0,"136":0,"137":0,"138":0,"139":0,"147":0,"155":0,"162":0,"169":0,"176":0,"192":0,"197":0,"200":0,"224":0,"225":0,"228":0,"231":0,"232":0,"233":0,"234":0,"237":0,"238":0,"241":0,"250":0,"251":0,"252":0,"261":0,"262":0,"263":0,"264":0,"267":0,"278":0,"289":0,"298":0,"299":0,"302":0,"303":0,"304":0,"305":0,"307":0,"314":0,"315":0,"316":0,"318":0,"325":0,"335":0,"343":0,"350":0,"359":0,"367":0,"368":0,"371":0,"375":0,"379":0,"387":0,"388":0,"395":0,"400":0};
-_yuitest_coverage["C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js"].functions = {"SignalBinding:42":0,"execute:95":0,"detach:111":0,"getListener:118":0,"dispose:126":0,"_destroy:135":0,"disable:146":0,"enable:154":0,"isEnabled:161":0,"isOnce:168":0,"toString:175":0,"Signal:192":0,"_registerListener:222":0,"_addBinding:248":0,"_indexOfListener:260":0,"add:277":0,"addOnce:288":0,"remove:297":0,"removeAll:313":0,"getNumListeners:324":0,"disable:334":0,"enable:342":0,"isEnabled:349":0,"halt:358":0,"dispatch:366":0,"dispose:386":0,"toString:394":0,"(anonymous 1):14":0};
-_yuitest_coverage["C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js"].coveredLines = 76;
-_yuitest_coverage["C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js"].coveredFunctions = 28;
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 14); var signals = (function(){
+_yuitest_coverage["/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js"].lines = {"14":0,"20":0,"46":0,"53":0,"60":0,"68":0,"75":0,"82":0,"85":0,"100":0,"101":0,"102":0,"103":0,"104":0,"107":0,"116":0,"123":0,"131":0,"132":0,"140":0,"141":0,"142":0,"143":0,"150":0,"157":0,"173":0,"178":0,"181":0,"206":0,"207":0,"210":0,"213":0,"214":0,"215":0,"216":0,"219":0,"220":0,"223":0,"232":0,"233":0,"234":0,"243":0,"244":0,"245":0,"246":0,"249":0,"260":0,"271":0,"280":0,"281":0,"284":0,"285":0,"286":0,"287":0,"289":0,"296":0,"297":0,"298":0,"300":0,"307":0,"316":0,"324":0,"325":0,"328":0,"332":0,"336":0,"344":0,"345":0,"352":0,"357":0};
+_yuitest_coverage["/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js"].functions = {"SignalBinding:46":0,"execute:99":0,"detach:115":0,"getListener:122":0,"dispose:130":0,"_destroy:139":0,"isOnce:149":0,"toString:156":0,"Signal:173":0,"_registerListener:204":0,"_addBinding:230":0,"_indexOfListener:242":0,"add:259":0,"addOnce:270":0,"remove:279":0,"removeAll:295":0,"getNumListeners:306":0,"halt:315":0,"dispatch:323":0,"dispose:343":0,"toString:351":0,"(anonymous 1):14":0};
+_yuitest_coverage["/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js"].coveredLines = 70;
+_yuitest_coverage["/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js"].coveredFunctions = 22;
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 14); var signals = (function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "(anonymous 1)", 14);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 16); var signals = /** @lends signals */{
+ /**
+ * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
+ * @name signals
+ */
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "(anonymous 1)", 14);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 20); var signals = /** @lends signals */{
/**
* Signals Version Number
- * @type string
+ * @type String
* @const
*/
- VERSION : '0.5.2'
+ VERSION : '0.5.4a'
};
// SignalBinding -------------------------------------------------
@@ -73,53 +77,53 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @param {Number} [priority] The priority level of the event listener. (default = 0).
*/
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 42); function SignalBinding(signal, listener, isOnce, listenerContext, priority){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 46); function SignalBinding(signal, listener, isOnce, listenerContext, priority){
/**
* Handler function bound to the signal.
* @type Function
* @private
*/
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "SignalBinding", 42);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 49); this._listener = listener;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "SignalBinding", 46);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 53); this._listener = listener;
/**
* If binding should be executed just once.
* @type boolean
* @private
*/
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 56); this._isOnce = isOnce;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 60); this._isOnce = isOnce;
/**
* Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @memberOf signals.SignalBinding.prototype
* @name context
- * @type {Object|undefined}
+ * @type Object|undefined|null
*/
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 64); this.context = listenerContext;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 68); this.context = listenerContext;
/**
* Reference to Signal object that listener is currently bound to.
* @type signals.Signal
* @private
*/
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 71); this._signal = signal;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 75); this._signal = signal;
/**
* Listener priority
* @type Number
* @private
*/
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 78); this._priority = priority || 0;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 82); this._priority = priority || 0;
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 81); SignalBinding.prototype = /** @lends signals.SignalBinding.prototype */ {
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 85); SignalBinding.prototype = /** @lends signals.SignalBinding.prototype */ {
/**
+ * If binding is active and should be executed.
* @type boolean
- * @private
*/
- _isEnabled : true,
+ active : true,
/**
* Call listener passing arbitrary parameters.
@@ -128,15 +132,15 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @return {*} Value returned by the listener.
*/
execute : function(paramsArr){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "execute", 95);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 96); var r;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 97); if(this._isEnabled){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 98); r = this._listener.apply(this.context, paramsArr);
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 99); if(this._isOnce){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 100); this.detach();
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "execute", 99);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 100); var r;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 101); if(this.active){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 102); r = this._listener.apply(this.context, paramsArr);
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 103); if(this._isOnce){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 104); this.detach();
}
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 103); return r;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 107); return r;
},
/**
@@ -145,16 +149,16 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @return {Function} Handler function bound to the signal.
*/
detach : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "detach", 111);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 112); return this._signal.remove(this._listener);
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "detach", 115);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 116); return this._signal.remove(this._listener);
},
/**
* @return {Function} Handler function bound to the signal.
*/
getListener : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "getListener", 118);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 119); return this._listener;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "getListener", 122);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 123); return this._listener;
},
/**
@@ -162,9 +166,9 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* <p><strong>IMPORTANT:</strong> calling methods on the binding instance after calling dispose will throw errors.</p>
*/
dispose : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "dispose", 126);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 127); this.detach();
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 128); this._destroy();
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "dispose", 130);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 131); this.detach();
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 132); this._destroy();
},
/**
@@ -172,53 +176,27 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @private
*/
_destroy : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "_destroy", 135);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 136); delete this._signal;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 137); delete this._isOnce;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 138); delete this._listener;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 139); delete this.context;
- },
-
- /**
- * Disable SignalBinding, block listener execution. Listener will only be executed after calling `enable()`.
- * @see signals.SignalBinding.enable()
- */
- disable : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "disable", 146);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 147); this._isEnabled = false;
- },
-
- /**
- * Enable SignalBinding. Enable listener execution.
- * @see signals.SignalBinding.disable()
- */
- enable : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "enable", 154);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 155); this._isEnabled = true;
- },
-
- /**
- * @return {boolean} If SignalBinding is currently paused and won't execute listener during dispatch.
- */
- isEnabled : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "isEnabled", 161);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 162); return this._isEnabled;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "_destroy", 139);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 140); delete this._signal;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 141); delete this._isOnce;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 142); delete this._listener;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 143); delete this.context;
},
/**
* @return {boolean} If SignalBinding will only be executed once.
*/
isOnce : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "isOnce", 168);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 169); return this._isOnce;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "isOnce", 149);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 150); return this._isOnce;
},
/**
* @return {string} String representation of the object.
*/
toString : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "toString", 175);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 176); return '[SignalBinding isOnce: '+ this._isOnce +', isEnabled: '+ this._isEnabled +']';
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "toString", 156);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 157); return '[SignalBinding isOnce: '+ this._isOnce +', active: '+ this.active +']';
}
};
@@ -234,16 +212,16 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @author Miller Medeiros
* @constructor
*/
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 192); signals.Signal = function(){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 173); signals.Signal = function(){
/**
* @type Array.<SignalBinding>
* @private
*/
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "Signal", 192);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 197); this._bindings = [];
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "Signal", 173);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 178); this._bindings = [];
};
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 200); signals.Signal.prototype = {
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 181); signals.Signal.prototype = {
/**
* @type boolean
@@ -252,10 +230,11 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
_shouldPropagate : true,
/**
+ * If Signal is active and should broadcast events.
+ * <p><strong>IMPORTANT:</strong> 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.</p>
* @type boolean
- * @private
*/
- _isEnabled : true,
+ active : true,
/**
* @param {Function} listener
@@ -267,25 +246,25 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
*/
_registerListener : function(listener, isOnce, scope, priority){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "_registerListener", 222);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 224); if(typeof listener !== 'function'){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 225); throw new Error('listener is a required param of add() and addOnce() and should be a Function.');
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "_registerListener", 204);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 206); if(typeof listener !== 'function'){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 207); throw new Error('listener is a required param of add() and addOnce() and should be a Function.');
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 228); var prevIndex = this._indexOfListener(listener),
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 210); var prevIndex = this._indexOfListener(listener),
binding;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 231); if(prevIndex !== -1){ //avoid creating a new Binding for same listener if already added to list
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 232); binding = this._bindings[prevIndex];
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 233); if(binding.isOnce() !== isOnce){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 234); throw new Error('You cannot add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.');
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 213); if(prevIndex !== -1){ //avoid creating a new Binding for same listener if already added to list
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 214); binding = this._bindings[prevIndex];
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 215); if(binding.isOnce() !== isOnce){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 216); throw new Error('You cannot add'+ (isOnce? '' : 'Once') +'() then add'+ (!isOnce? '' : 'Once') +'() the same listener without removing the relationship first.');
}
} else {
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 237); binding = new SignalBinding(this, listener, isOnce, scope, priority);
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 238); this._addBinding(binding);
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 219); binding = new SignalBinding(this, listener, isOnce, scope, priority);
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 220); this._addBinding(binding);
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 241); return binding;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 223); return binding;
},
/**
@@ -294,10 +273,10 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
*/
_addBinding : function(binding){
//simplified insertion sort
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "_addBinding", 248);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 250); var n = this._bindings.length;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 251); do { --n; }while (this._bindings[n] && binding._priority <= this._bindings[n]._priority);
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 252); this._bindings.splice(n+1, 0, binding);
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "_addBinding", 230);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 232); var n = this._bindings.length;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 233); do { --n; }while (this._bindings[n] && binding._priority <= this._bindings[n]._priority);
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 234); this._bindings.splice(n+1, 0, binding);
},
/**
@@ -306,14 +285,14 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @private
*/
_indexOfListener : function(listener){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "_indexOfListener", 260);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 261); var n = this._bindings.length;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 262); while(n--){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 263); if(this._bindings[n]._listener === listener){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 264); return n;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "_indexOfListener", 242);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 243); var n = this._bindings.length;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 244); while(n--){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 245); if(this._bindings[n]._listener === listener){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 246); return n;
}
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 267); return -1;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 249); return -1;
},
/**
@@ -324,8 +303,8 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @return {SignalBinding} An Object representing the binding between the Signal and listener.
*/
add : function(listener, scope, priority){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "add", 277);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 278); return this._registerListener(listener, false, scope, priority);
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "add", 259);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 260); return this._registerListener(listener, false, scope, priority);
},
/**
@@ -336,8 +315,8 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @return {SignalBinding} An Object representing the binding between the Signal and listener.
*/
addOnce : function(listener, scope, priority){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "addOnce", 288);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 289); return this._registerListener(listener, true, scope, priority);
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "addOnce", 270);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 271); return this._registerListener(listener, true, scope, priority);
},
/**
@@ -346,65 +325,37 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @return {Function} Listener handler function.
*/
remove : function(listener){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "remove", 297);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 298); if(typeof listener !== 'function'){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 299); throw new Error('listener is a required param of remove() and should be a Function.');
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "remove", 279);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 280); if(typeof listener !== 'function'){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 281); throw new Error('listener is a required param of remove() and should be a Function.');
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 302); var i = this._indexOfListener(listener);
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 303); if(i !== -1){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 304); this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 305); this._bindings.splice(i, 1);
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 284); var i = this._indexOfListener(listener);
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 285); if(i !== -1){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 286); this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 287); this._bindings.splice(i, 1);
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 307); return listener;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 289); return listener;
},
/**
* Remove all listeners from the Signal.
*/
removeAll : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "removeAll", 313);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 314); var n = this._bindings.length;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 315); while(n--){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 316); this._bindings[n]._destroy();
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "removeAll", 295);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 296); var n = this._bindings.length;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 297); while(n--){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 298); this._bindings[n]._destroy();
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 318); this._bindings.length = 0;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 300); this._bindings.length = 0;
},
/**
* @return {number} Number of listeners attached to the Signal.
*/
getNumListeners : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "getNumListeners", 324);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 325); return this._bindings.length;
- },
-
- /**
- * Disable Signal. Block dispatch to listeners until `enable()` is called.
- * <p><strong>IMPORTANT:</strong> If this method is called during a dispatch it will only have effect on the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>
- * @see signals.Signal.prototype.enable
- * @see signals.Signal.prototype.halt
- */
- disable : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "disable", 334);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 335); this._isEnabled = false;
- },
-
- /**
- * Enable broadcast to listeners.
- * @see signals.Signal.prototype.disable
- */
- enable : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "enable", 342);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 343); this._isEnabled = true;
- },
-
- /**
- * @return {boolean} If Signal is currently enabled and will broadcast message to listeners.
- */
- isEnabled : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "isEnabled", 349);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 350); return this._isEnabled;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "getNumListeners", 306);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 307); return this._bindings.length;
},
/**
@@ -413,8 +364,8 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @see signals.Signal.prototype.disable
*/
halt : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "halt", 358);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 359); this._shouldPropagate = false;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "halt", 315);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 316); this._shouldPropagate = false;
},
/**
@@ -422,20 +373,20 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* @param {...*} [params] Parameters that should be passed to each handler.
*/
dispatch : function(params){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "dispatch", 366);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 367); if(! this._isEnabled){
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 368); return;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "dispatch", 323);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 324); if(! this.active){
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 325); return;
}
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 371); var paramsArr = Array.prototype.slice.call(arguments),
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 328); var paramsArr = Array.prototype.slice.call(arguments),
bindings = this._bindings.slice(), //clone array in case add/remove items during dispatch
n = this._bindings.length;
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 375); this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch.
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 332); this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch.
//execute all callbacks until end of the list or until a callback returns `false` or stops propagation
//reverse loop since listeners with higher priority will be added at the end of the list
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 379); do { n--; }while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false);
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 336); do { n--; }while (bindings[n] && this._shouldPropagate && bindings[n].execute(paramsArr) !== false);
},
/**
@@ -443,21 +394,21 @@ _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-s
* <p><strong>IMPORTANT:</strong> calling any method on the signal instance after calling dispose will throw errors.</p>
*/
dispose : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "dispose", 386);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 387); this.removeAll();
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 388); delete this._bindings;
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "dispose", 343);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 344); this.removeAll();
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 345); delete this._bindings;
},
/**
* @return {string} String representation of the object.
*/
toString : function(){
- _yuitest_coverfunc("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", "toString", 394);
-_yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 395); return '[Signal isEnabled: '+ this._isEnabled +' numListeners: '+ this.getNumListeners() +']';
+ _yuitest_coverfunc("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", "toString", 351);
+_yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 352); return '[Signal active: '+ this.active +' numListeners: '+ this.getNumListeners() +']';
}
};
- _yuitest_coverline("C:\Miller\Personal\open_source_projects\js-signals\dist\js-signals.js", 400); return signals;
+ _yuitest_coverline("/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js", 357); return signals;
}());
808 ...n_source_projectsjs_signalsdistjs_signals.js.html → ...s__open_source_js_signals_dist_js_signals.js.html
View
361 additions, 447 deletions not shown
10 dev/tests/coverage/report/index.html
View
@@ -73,7 +73,7 @@
<div class="hd">
<!-- title -->
<h1>Code Coverage Report</h1>
- <h2>Date Generated: Mon Feb 21 18:07:01 EST 2011</h2>
+ <h2>Date Generated: Sat Apr 09 16:56:53 BRT 2011</h2>
</div>
<div class="bd">
@@ -89,9 +89,9 @@
</thead>
<tbody>
<tr>
- <td class="filename"><a href="C_MillerPersonalopen_source_projectsjs_signalsdistjs_signals.js.html">C:MillerPersonalopen_source_projectsjs-signalsdistjs-signals.js</a></td>
- <td class="results">74/76 (97.37%)</td>
- <td class="results">26/28 (92.86%)</td>
+ <td class="filename"><a href="_Users_millermedeiros_Documents_Projects__open_source_js_signals_dist_js_signals.js.html">/Users/millermedeiros/Documents/Projects/_open_source/js-signals/dist/js-signals.js</a></td>
+ <td class="results">68/70 (97.14%)</td>
+ <td class="results">20/22 (90.91%)</td>
</tr>
</tbody>
</table>
@@ -99,7 +99,7 @@
<!-- footer -->
<div class="ft">
- <p>Code coverage report generated on Mon Feb 21 18:07:01 EST 2011 by YUI Test.</p>
+ <p>Code coverage report generated on Sat Apr 09 16:56:53 BRT 2011 by YUI Test.</p>
</div>
</div>
26 dev/tests/src/01.js
View
@@ -782,15 +782,15 @@ YUI().use('node', 'console', 'test', function (Y){
s.add(l2);
s.add(l3);
- Y.Assert.areSame(true, s.isEnabled());
+ Y.Assert.areSame(true, s.active);
s.dispatch();
- s.disable();
- Y.Assert.areSame(false, s.isEnabled());
+ s.active = false;
+ Y.Assert.areSame(false, s.active);
s.dispatch();
- s.enable();
- Y.Assert.areSame(true, s.isEnabled());
+ s.active = true;
+ Y.Assert.areSame(true, s.active);
s.dispatch();
Y.Assert.areSame(6, n);
@@ -808,18 +808,18 @@ YUI().use('node', 'console', 'test', function (Y){
var b2 = s.add(l2);
var b3 = s.add(l3);
- Y.Assert.areSame(true, s.isEnabled());
- Y.Assert.areSame(true, b2.isEnabled());
+ Y.Assert.areSame(true, s.active);
+ Y.Assert.areSame(true, b2.active);
s.dispatch();
- b2.disable();
- Y.Assert.areSame(true, s.isEnabled());
- Y.Assert.areSame(false, b2.isEnabled());
+ b2.active = false;
+ Y.Assert.areSame(true, s.active);
+ Y.Assert.areSame(false, b2.active);
s.dispatch();
- b2.enable();
- Y.Assert.areSame(true, s.isEnabled());
- Y.Assert.areSame(true, b2.isEnabled());
+ b2.active = true;
+ Y.Assert.areSame(true, s.active);
+ Y.Assert.areSame(true, b2.active);
s.dispatch();
Y.Assert.areSame(8, n);
4 dist/docs/files.html
View
@@ -46,7 +46,7 @@ <h1 class="classTitle">File Index</h1>
<div class="member">
- <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>
+ <h2><a href="symbols/src/_Users_millermedeiros_Documents_Projects__open_source_js-signals_dist_js-signals.js.html">/Users/millermedeiros/Documents/Projects/_open_source/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 Mon Feb 21 2011 19:18:55 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Apr 09 2011 17:27:24 GMT-0300 (BRT)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
2  dist/docs/index.html
View
@@ -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 Mon Feb 21 2011 19:18:55 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Apr 09 2011 17:27:24 GMT-0300 (BRT)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
46 dist/docs/symbolindex.html
View
@@ -89,6 +89,17 @@ <h1 id="classTitle">Symbol Index</h1>
<table id="symbolOverview">
<tr class="symbolEntry">
+ <td class="symbolName">active</td>
+ <td>
+
+ <a href="symbols/signals.Signal.html#active">signals.Signal#active</a>
+
+ <a href="symbols/signals.SignalBinding.html#active">signals.SignalBinding#active</a>
+
+ </td>
+ </tr>
+
+ <tr class="symbolEntry">
<td class="symbolName">add</td>
<td>
@@ -125,17 +136,6 @@ <h1 id="classTitle">Symbol Index</h1>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">disable</td>
- <td>
-
- <a href="symbols/signals.Signal.html#disable">signals.Signal#disable</a>
-
- <a href="symbols/signals.SignalBinding.html#disable">signals.SignalBinding#disable</a>
-
- </td>
- </tr>
-
- <tr class="symbolEntry">
<td class="symbolName">dispatch</td>
<td>
@@ -156,17 +156,6 @@ <h1 id="classTitle">Symbol Index</h1>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">enable</td>
- <td>
-
- <a href="symbols/signals.Signal.html#enable">signals.Signal#enable</a>
-
- <a href="symbols/signals.SignalBinding.html#enable">signals.SignalBinding#enable</a>
-
- </td>
- </tr>
-
- <tr class="symbolEntry">
<td class="symbolName">execute</td>
<td>
@@ -203,17 +192,6 @@ <h1 id="classTitle">Symbol Index</h1>
</tr>
<tr class="symbolEntry">
- <td class="symbolName">isEnabled</td>
- <td>
-
- <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">isOnce</td>
<td>
@@ -293,7 +271,7 @@ <h1 id="classTitle">Symbol 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 Mon Feb 21 2011 19:18:55 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Apr 09 2011 17:27:24 GMT-0300 (BRT)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
2  dist/docs/symbols/_global_.html
View
@@ -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 Mon Feb 21 2011 19:18:55 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Apr 09 2011 17:27:24 GMT-0300 (BRT)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
164 dist/docs/symbols/signals.Signal.html
View
@@ -63,6 +63,15 @@
<!-- properties list -->
+ <h3>Fields</h3>
+ <ul>
+
+ <li class="fixedFont">
+ <a href="../symbols/signals.Signal.html#active">active</a>
+ </li>
+
+ </ul>
+
<!-- end properties list -->
<!-- function summary -->
@@ -80,10 +89,6 @@
</li>
<li class="fixedFont">
- <a href="../symbols/signals.Signal.html#disable">disable</a>
- </li>
-
- <li class="fixedFont">
<a href="../symbols/signals.Signal.html#dispatch">dispatch</a>
</li>
@@ -92,10 +97,6 @@
</li>
<li class="fixedFont">
- <a href="../symbols/signals.Signal.html#enable">enable</a>
- </li>
-
- <li class="fixedFont">
<a href="../symbols/signals.Signal.html#getNumListeners">getNumListeners</a>
</li>
@@ -104,10 +105,6 @@
</li>
<li class="fixedFont">
- <a href="../symbols/signals.Signal.html#isEnabled">isEnabled</a>
- </li>
-
- <li class="fixedFont">
<a href="../symbols/signals.Signal.html#remove">remove</a>
</li>
@@ -143,7 +140,7 @@ <h1 class="classTitle">
- <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>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/_Users_millermedeiros_Documents_Projects__open_source_js-signals_dist_js-signals.js.html">js-signals.js</a>.
</p>
@@ -180,6 +177,39 @@ <h1 class="classTitle">
<!-- ============================== field details ========================== -->
+ <div class="details">
+ <div class="sectionTitle">
+ Field Detail
+ </div>
+
+ <div class="member">
+ <a name="active"> </a>
+ <div class="fixedFont">
+ <div class="modifiers">
+ </div>
+
+ <span class="light">{boolean}</span>
+ <b>active</b>
+
+ </div>
+ <div class="description">
+ <p>If Signal is active and should broadcast events.</p>
+
+<p><strong>IMPORTANT:</strong> 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.</p>
+
+
+ </div>
+
+
+
+
+
+
+
+ </div>
+
+ </div>
+
<!-- ============================== method details ========================= -->
@@ -303,44 +333,6 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="disable"> </a>
- <div class="fixedFont">
- <div class="modifiers">
- </div>
-
- <b>disable</b>()
-
- </div>
- <div class="description">
- <p>Disable Signal. Block dispatch to listeners until <code>enable()</code> is called.</p>
-
-<p><strong>IMPORTANT:</strong> If this method is called during a dispatch it will only have effect on the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>
-
-
- </div>
-
-
-
-
-
-
-
-
-
-
- <dl class="detailList">
- <dt class="heading">See:</dt>
-
- <dd>signals.Signal.prototype.enable</dd>
-
- <dd>signals.Signal.prototype.halt</dd>
-
- </dl>
-
-
- </div>
-
- <div class="member">
<a name="dispatch"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -408,40 +400,6 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="enable"> </a>
- <div class="fixedFont">
- <div class="modifiers">
- </div>
-
- <b>enable</b>()
-
- </div>
- <div class="description">
- <p>Enable broadcast to listeners.</p>
-
-
- </div>
-
-
-
-
-
-
-
-
-
-
- <dl class="detailList">
- <dt class="heading">See:</dt>
-
- <dd>signals.Signal.prototype.disable</dd>
-
- </dl>
-
-
- </div>
-
- <div class="member">
<a name="getNumListeners"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -512,40 +470,6 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="isEnabled"> </a>
- <div class="fixedFont">
- <div class="modifiers">
- </div>
- <span class="light">{boolean}</span>
- <b>isEnabled</b>()
-
- </div>
- <div class="description">
-
-
-
- </div>
-
-
-
-
-
-
-
-
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
-
- <dd><span class="light fixedFont">{boolean}</span> If Signal is currently enabled and will broadcast message to listeners.</dd>
-
- </dl>
-
-
-
-
- </div>
-
- <div class="member">
<a name="remove"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -663,7 +587,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 Mon Feb 21 2011 19:18:55 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Apr 09 2011 17:27:24 GMT-0300 (BRT)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
148 dist/docs/symbols/signals.SignalBinding.html
View
@@ -67,6 +67,10 @@
<ul>
<li class="fixedFont">
+ <a href="../symbols/signals.SignalBinding.html#active">active</a>
+ </li>
+
+ <li class="fixedFont">
<a href="../symbols/signals.SignalBinding.html#context">context</a>
</li>
@@ -85,18 +89,10 @@
</li>
<li class="fixedFont">
- <a href="../symbols/signals.SignalBinding.html#disable">disable</a>
- </li>
-
- <li class="fixedFont">
<a href="../symbols/signals.SignalBinding.html#dispose">dispose</a>
</li>
<li class="fixedFont">
- <a href="../symbols/signals.SignalBinding.html#enable">enable</a>
- </li>
-
- <li class="fixedFont">
<a href="../symbols/signals.SignalBinding.html#execute">execute</a>
</li>
@@ -105,10 +101,6 @@
</li>
<li class="fixedFont">
- <a href="../symbols/signals.SignalBinding.html#isEnabled">isEnabled</a>
- </li>
-
- <li class="fixedFont">
<a href="../symbols/signals.SignalBinding.html#isOnce">isOnce</a>
</li>
@@ -140,7 +132,7 @@ <h1 class="classTitle">
- <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>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/_Users_millermedeiros_Documents_Projects__open_source_js-signals_dist_js-signals.js.html">js-signals.js</a>.
</p>
@@ -219,12 +211,36 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="context"> </a>
+ <a name="active"> </a>
<div class="fixedFont">
<div class="modifiers">
</div>
+ <span class="light">{boolean}</span>
+ <b>active</b>
+
+ </div>
+ <div class="description">
+ <p>If binding is active and should be executed.</p>
+
+
+ </div>
+
+
+
+
+
+
+
+ </div>
+
+ <div class="member">
+ <a name="context"> </a>
+ <div class="fixedFont">
+ <div class="modifiers">
+ </div>
+ <span class="light">{Object|undefined|null}</span>
<b>context</b>
</div>
@@ -288,40 +304,6 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="disable"> </a>
- <div class="fixedFont">
- <div class="modifiers">
- </div>
-
- <b>disable</b>()
-
- </div>
- <div class="description">
- <p>Disable SignalBinding, block listener execution. Listener will only be executed after calling <code>enable()</code>.</p>
-
-
- </div>
-
-
-
-
-
-
-
-
-
-
- <dl class="detailList">
- <dt class="heading">See:</dt>
-
- <dd>signals.SignalBinding.enable()</dd>
-
- </dl>
-
-
- </div>
-
- <div class="member">
<a name="dispose"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -351,40 +333,6 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="enable"> </a>
- <div class="fixedFont">
- <div class="modifiers">
- </div>
-
- <b>enable</b>()
-
- </div>
- <div class="description">
- <p>Enable SignalBinding. Enable listener execution.</p>
-
-
- </div>
-
-
-
-
-
-
-
-
-
-
- <dl class="detailList">
- <dt class="heading">See:</dt>
-
- <dd>signals.SignalBinding.disable()</dd>
-
- </dl>
-
-
- </div>
-
- <div class="member">
<a name="execute"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -466,40 +414,6 @@ <h1 class="classTitle">
</div>
<div class="member">
- <a name="isEnabled"> </a>
- <div class="fixedFont">
- <div class="modifiers">
- </div>
- <span class="light">{boolean}</span>
- <b>isEnabled</b>()
-
- </div>
- <div class="description">
-
-
-
- </div>
-
-
-
-
-
-
-
-
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
-
- <dd><span class="light fixedFont">{boolean}</span> If SignalBinding is currently paused and won't execute listener during dispatch.</dd>
-
- </dl>
-
-
-
-
- </div>
-
- <div class="member">
<a name="isOnce"> </a>
<div class="fixedFont">
<div class="modifiers">
@@ -579,7 +493,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 Mon Feb 21 2011 19:18:55 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Apr 09 2011 17:27:24 GMT-0300 (BRT)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
6 dist/docs/symbols/signals.html
View
@@ -99,7 +99,7 @@ <h1 class="classTitle">
Signals Namespace - Custom event/messaging system based on AS3 Signals
- <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>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/_Users_millermedeiros_Documents_Projects__open_source_js-signals_dist_js-signals.js.html">js-signals.js</a>.
</p>
@@ -146,7 +146,7 @@ <h1 class="classTitle">
<div class="modifiers">&lt;static&gt;
</div>
- <span class="light">{string}</span>
+ <span class="light">{String}</span>
<span class="light">signals.</span><b>VERSION</b>
</div>
@@ -179,7 +179,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 Mon Feb 21 2011 19:18:55 GMT-0500 (EST)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Apr 09 2011 17:27:24 GMT-0300 (BRT)
| template based on Steffen Siering <a href="http://github.com/urso/jsdoc-simple">jsdoc-simple</a>.
</div>
</body>
409 dist/docs/symbols/src/C__Miller_Personal_open_source_projects_js-signals_dist_js-signals.js.html
View
@@ -1,409 +0,0 @@
-<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">/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */</span><span class="WHIT">
-<span class='line'> 2</span>
-<span class='line'> 3</span> </span><span class="COMM">/*!!
-<span class='line'> 4</span> * JS Signals &lt;http://millermedeiros.github.com/js-signals/>
-<span class='line'> 5</span> * Released under the MIT license &lt;http://www.opensource.org/licenses/mit-license.php>
-<span class='line'> 6</span> * @author Miller Medeiros &lt;http://millermedeiros.com/>
-<span class='line'> 7</span> * @version 0.5.3
-<span class='line'> 8</span> * @build 143 (02/21/2011 07:18 PM)
-<span class='line'> 9</span> */</span><span class="WHIT">
-<span class='line'> 10</span>
-<span class='line'> 11</span> </span><span class="COMM">/**
-<span class='line'> 12</span> * @namespace Signals Namespace - Custom event/messaging system based on AS3 Signals
-<span class='line'> 13</span> */</span><span class="WHIT">
-<span class='line'> 14</span> </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="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'> 15</span> </span><span class="WHIT"> </span><span class="WHIT">
-<span class='line'> 16</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="COMM">/** @lends signals */</span><span class="PUNC">{</span><span class="WHIT">
-<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="COMM">/**
-<span class='line'> 18</span> * Signals Version Number
-<span class='line'> 19</span> * @type string
-<span class='line'> 20</span> * @const
-<span class='line'> 21</span> */</span><span class="WHIT">
-<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="NAME">VERSION</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.5.3'</span><span class="WHIT">
-<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
-<span class='line'> 24</span>
-<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="COMM">// SignalBinding -------------------------------------------------</span><span class="WHIT">
-<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="COMM">//================================================================</span><span class="WHIT">
-<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="WHIT">
-<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="COMM">/**
-<span class='line'> 29</span> * Object that represents a binding between a Signal and a listener function.
-<span class='line'> 30</span> * &lt;br />- &lt;strong>This is an internal constructor and shouldn't be called by regular users.&lt;/strong>
-<span class='line'> 31</span> * &lt;br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
-<span class='line'> 32</span> * @author Miller Medeiros
-<span class='line'> 33</span> * @constructor
-<span class='line'> 34</span> * @internal
-<span class='line'> 35</span> * @name signals.SignalBinding
-<span class='line'> 36</span> * @param {signals.Signal} signal Reference to Signal object that listener is currently bound to.
-<span class='line'> 37</span> * @param {Function} listener Handler function bound to the signal.
-<span class='line'> 38</span> * @param {boolean} isOnce If binding should be executed just once.
-<span class='line'> 39</span> * @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
-<span class='line'> 40</span> * @param {Number} [priority] The priority level of the event listener. (default = 0).
-<span class='line'> 41</span> */</span><span class="WHIT">
-<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">SignalBinding</span><span class="PUNC">(</span><span class="NAME">signal</span><span class="PUNC">,</span><span class="WHIT"> </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">listenerContext</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">priority</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
-<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="WHIT">
-<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="COMM">/**
-<span class='line'> 45</span> * Handler function bound to the signal.
-<span class='line'> 46</span> * @type Function
-<span class='line'> 47</span> * @private
-<span class='line'> 48</span> */</span><span class="WHIT">
-<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="NAME">this._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 class='line'> 50</span> </span><span class="WHIT"> </span><span class="WHIT">
-<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="COMM">/**
-<span class='line'> 52</span> * If binding should be executed just once.
-<span class='line'> 53</span> * @type boolean
-<span class='line'> 54</span> * @private
-<span class='line'> 55</span> */</span><span class="WHIT">
-<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="NAME">this._isOnce</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">isOnce</span><span class="PUNC">;</span><span class="WHIT">
-<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="WHIT">
-<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="COMM">/**
-<span class='line'> 59</span> * Context on which listener will be executed (object that should represent the `this` variable inside listener function).
-<span class='line'> 60</span> * @memberOf signals.SignalBinding.prototype
-<span class='line'> 61</span> * @name context
-<span class='line'> 62</span> * @type {Object|undefined}
-<span class='line'> 63</span> */</span><span class="WHIT">
-<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="NAME">this.context</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">listenerContext</span><span class="PUNC">;</span><span class="WHIT">
-<span