summaryrefslogtreecommitdiff
path: root/src/history.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-11-29 22:29:58 +0200
committerAlon Levy <alon@pobox.com>2014-11-29 22:39:03 +0200
commitc8ad3bcd2d0bf7a8b23b2726d756d25536ce1c6a (patch)
treeeedff4e5f3d00639297ce2012e5d761c5d5fafb1 /src/history.js
parent42eacd877b5564961c2dcc491f5d4b7d62f4e753 (diff)
history: record input field
Diffstat (limited to 'src/history.js')
-rw-r--r--src/history.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/history.js b/src/history.js
index a6a02ec3..37e96718 100644
--- a/src/history.js
+++ b/src/history.js
@@ -31,6 +31,7 @@ function History(user, graph, transform_element) {
return that.record_graph_diff(obj)
});
rz_bus.ui_key.onValue(that.record_keystrokes.bind(that));
+ rz_bus.ui_input.onValue(that.record_input.bind(that));
// XXX create zoom behavior - then proof to event name change
$(window).on('wheel.history', function(obj) {
that.record_zoom(obj);
@@ -39,6 +40,7 @@ function History(user, graph, transform_element) {
}
var ACTION_KEYSTROKES = 'ACTION_KEYSTROKES';
+var ACTION_INPUT = 'ACTION_INPUT';
var ACTION_GRAPH_DIFF = 'ACTION_GRAPH_DIFF';
var ACTION_ZOOM = 'ACTION_ZOOM';
@@ -126,6 +128,18 @@ History.prototype.record_keystrokes = function(obj)
});
}
+History.prototype.record_input = function(obj)
+{
+ var where = obj.where,
+ input = obj.input;
+
+ if (where === undefined || input === undefined || input.length === undefined || typeof input !== 'string') {
+ console.log('invalid arguments');
+ return;
+ }
+ this.record(ACTION_INPUT, {where: where, input: input});
+}
+
return {
History:History,
KEYSTROKE_WHERE_TEXTANALYSIS:KEYSTROKE_WHERE_TEXTANALYSIS,