summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorportix <none@none>2013-03-20 02:23:51 +0100
committerportix <none@none>2013-03-20 02:23:51 +0100
commit52e3bbeb75dd6d213b55620c5c61d16a11c3cecd (patch)
treec953fd261158e1b02b7c21d1f485c1cd003559e8 /scripts
parent295029c618c3e2c7e5aa557db72a6249b350f447 (diff)
downloaddwb-52e3bbeb75dd6d213b55620c5c61d16a11c3cecd.zip
Implementing Signal.toggle
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/signals.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/lib/signals.js b/scripts/lib/signals.js
index fabddfc4..12a92179 100644
--- a/scripts/lib/signals.js
+++ b/scripts/lib/signals.js
@@ -228,6 +228,30 @@
{
return Boolean(_connectedMapping[this.id]);
}
+ },
+ /**
+ * Toggles a signal, if it is connected it will be
+ * disconnected and vice versa
+ *
+ * @name toggle
+ * @memberOf Signal.prototype
+ * @function
+ *
+ * @returns {Boolean}
+ * <i>true if the signal was connected, <i>false</i>
+ * otherwise
+ * */
+ "toggle" :
+ {
+ value : function()
+ {
+ var connected = this.isConnected();
+ if (connected)
+ this.disconnect();
+ else
+ this.connect();
+ return !connected;
+ }
}
}
);