From 42eacd877b5564961c2dcc491f5d4b7d62f4e753 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sat, 29 Nov 2014 22:28:29 +0200 Subject: use Bacon instead of signal See https://github.com/baconjs/bacon.js Usage right now: we have rz_bus to hold global busses: - names: for autosuggest - ui busses: - ui_key - ui_input The events are objects with {where: from consts, keys/input} (could maybe just use the events and rely on the target element class/id) And graph has it's own bus: graph.diffBus (camelcase probably not the right style - will fix in later commit) To publish to a bus you use push. To insert another stream to a bus you use plug. To listen to a bus you use onValue (you can use subscribe too to get errors and end of stream event, but we don't use that yet). This allows usage of map, filter, flatMap, see github repo for cool examples. --- src/signal.js | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 src/signal.js (limited to 'src/signal.js') diff --git a/src/signal.js b/src/signal.js deleted file mode 100644 index e5888b4c..00000000 --- a/src/signal.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 - }; -}) -- cgit v1.3.1