diff options
| author | Alon Levy <alon@pobox.com> | 2014-11-29 22:28:29 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-11-29 22:33:44 +0200 |
| commit | 42eacd877b5564961c2dcc491f5d4b7d62f4e753 (patch) | |
| tree | 6fce918b89bc0093671db978a26d5821036e1ade /src/rz_core.js | |
| parent | 372aac3fafedbd517cf26501ef70015f47feb7f9 (diff) | |
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.
Diffstat (limited to 'src/rz_core.js')
| -rw-r--r-- | src/rz_core.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/rz_core.js b/src/rz_core.js index 44dd02fb..46fc753a 100644 --- a/src/rz_core.js +++ b/src/rz_core.js @@ -1,7 +1,7 @@ "use strict" -define(['jquery', 'd3', 'consts', 'signal', 'util', 'model/graph', 'model/core', 'view/helpers', 'view/view', 'rz_observer', 'view/selection'], -function($, d3, consts, signal, util, model_graph, model_core, view_helpers, view, rz_observer, selection) { +define(['jquery', 'd3', 'consts', 'rz_bus', 'util', 'model/graph', 'model/core', 'view/helpers', 'view/view', 'rz_observer', 'view/selection'], +function($, d3, consts, rz_bus, util, model_graph, model_core, view_helpers, view, rz_observer, selection) { var addednodes = []; @@ -597,7 +597,7 @@ function mousedown() { } $('#editform').keypress(function(e) { - signal.signal(consts.KEYSTROKES, [{where: consts.KEYSTROKE_WHERE_EDIT_NODE, keys: [e.which]}]); + var ret = undefined; if (e.which == 13) { $('.editinfo').css('top', -100); $('.editinfo').css('left', 0); @@ -606,8 +606,10 @@ $('#editform').keypress(function(e) { var d = element.data().d; graph.editName(d.id, newname); update_view__graph(true); - return false; + ret = false; } + rz_bus.ui_key.push({where: consts.KEYSTROKE_WHERE_EDIT_NODE, keys: [e.which]}); + return ret; }); |
