summaryrefslogtreecommitdiff
path: root/src/signal.js
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-11-13 17:41:57 +0200
committerLV-426 <lv-426@taproot.org.il>2014-11-13 17:41:57 +0200
commit76d1de512a58f023ae348ae8500100490fba9915 (patch)
tree87a3df058d3aaf1a3f2c408a784ffe63209cdaac /src/signal.js
parent4a303d5a7a7e1f8327bb18a2ef3e3093a30a50b6 (diff)
rename scripts/ -> src/
Diffstat (limited to 'src/signal.js')
-rw-r--r--src/signal.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/signal.js b/src/signal.js
new file mode 100644
index 00000000..e5888b4c
--- /dev/null
+++ b/src/signal.js
@@ -0,0 +1,22 @@
+/*
+ * Signal/slot (i.e. blackboard pattern) for rhizi.
+ *
+ * This is a thin wrapper over jquery right now.
+ * But just keeping it here to make any future change of implementation slightly
+ * easier.
+ */
+
+define(['jquery'], function($) {
+ function slot(name, handler) {
+ $(window).on(name, function(e, args) {
+ handler(args);
+ });
+ };
+ function signal(name, obj) {
+ $(window).trigger(name, obj);
+ }
+ return {
+ 'slot': slot,
+ 'signal': signal
+ };
+})