diff options
| author | Alon Levy <alon@pobox.com> | 2015-01-27 11:53:45 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-01-27 11:53:45 +0200 |
| commit | dff333b558cb29f1c6fa6d13ee4239a9bc0a81a6 (patch) | |
| tree | 881a08eda7433fc478d219e6302640dd04ccef18 /src/client/view/graph_view.js | |
| parent | 19d9fad85ad6dacd419530f3d9d26f952b663c11 (diff) | |
client: remove state variable in node view and use bacon property instead
Diffstat (limited to 'src/client/view/graph_view.js')
| -rw-r--r-- | src/client/view/graph_view.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js index 2315eb10..fe18ed5c 100644 --- a/src/client/view/graph_view.js +++ b/src/client/view/graph_view.js @@ -147,12 +147,11 @@ function GraphView(spec) { }); function showNodeInfo(node) { - var closed = false; + var diffBusUnsubscribe; util.assert(!temporary, "cannot showNodeInfo on a temporary graph"); view.node_info.on_save(function(e, form_data) { - closed = true; graph.update_node(node, form_data, function() { var old_type = node.type, new_type = form_data.type; @@ -162,12 +161,25 @@ function GraphView(spec) { return false; }); - graph.diffBus.onValue(function (diff) { - if (closed || !model_diff.is_attr_diff(diff)) { - return Bacon.noMore; + diffBusUnsubscribe = graph.diffBus.onValue(function (diff) { + if (!model_diff.is_attr_diff(diff)) { + console.log('node_edit listener for ' + node.id + ': ignoring diff'); + return; } view.node_info.show(node); }); + view.node_info.isOpenProperty.skip(1).onValue(function (open) { + var ISaidNoMore = false; + if (ISaidNoMore) { + console.log('MAYDAY MAYDAY why am I here??'); + } + if (!open) { + console.log('node_edit listener for ' + node.id + ': shutting down'); + diffBusUnsubscribe(); + ISaidNoMore = true; + return Bacon.noMore; + } + }) view.node_info.on_delete(function() { var topo_diff = model_diff.new_topo_diff({ |
