aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/stores
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-09-17 15:22:42 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-09-17 15:22:42 +0200
commit8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6 (patch)
tree7ead6c2c6a6ed2fadba59aefa1d5743fbc4dfe9b /web/src/js/stores
parentb4ecd96beb77a8bae02d82eac174dded198797a3 (diff)
downloadmitmproxy-8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6.tar.gz
mitmproxy-8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6.tar.bz2
mitmproxy-8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6.zip
connect eventlog events to ui
Diffstat (limited to 'web/src/js/stores')
-rw-r--r--web/src/js/stores/base.js3
-rw-r--r--web/src/js/stores/eventlogstore.js16
-rw-r--r--web/src/js/stores/settingstore.js4
3 files changed, 13 insertions, 10 deletions
diff --git a/web/src/js/stores/base.js b/web/src/js/stores/base.js
index 9a2dbd64..952fa847 100644
--- a/web/src/js/stores/base.js
+++ b/web/src/js/stores/base.js
@@ -5,8 +5,9 @@ EventEmitter.prototype.emit = function (event) {
if (!(event in this.listeners)) {
return;
}
+ var args = Array.prototype.slice.call(arguments, 1);
this.listeners[event].forEach(function (listener) {
- listener.apply(this, arguments);
+ listener.apply(this, args);
}.bind(this));
};
EventEmitter.prototype.addListener = function (event, f) {
diff --git a/web/src/js/stores/eventlogstore.js b/web/src/js/stores/eventlogstore.js
index 54c45939..976f7524 100644
--- a/web/src/js/stores/eventlogstore.js
+++ b/web/src/js/stores/eventlogstore.js
@@ -7,19 +7,19 @@
// See also: components/EventLog.react.js
function EventLogView(store, live) {
EventEmitter.call(this);
- this.$EventLogView_store = store;
+ this._store = store;
this.live = live;
this.log = [];
this.add = this.add.bind(this);
if (live) {
- this.$EventLogView_store.addListener("new_entry", this.add);
+ this._store.addListener(ActionTypes.ADD_EVENT, this.add);
}
}
_.extend(EventLogView.prototype, EventEmitter.prototype, {
close: function () {
- this.$EventLogView_store.removeListener("new_entry", this.add);
+ this._store.removeListener(ActionTypes.ADD_EVENT, this.add);
},
getAll: function () {
return this.log;
@@ -46,7 +46,8 @@ function _EventLogStore() {
_.extend(_EventLogStore.prototype, EventEmitter.prototype, {
getView: function (since) {
var view = new EventLogView(this, !since);
-
+ return view;
+ /*
//TODO: Really do bulk retrieval of last messages.
window.setTimeout(function () {
view.add_bulk([
@@ -77,11 +78,12 @@ _.extend(_EventLogStore.prototype, EventEmitter.prototype, {
});
}, 1000);
return view;
+ */
},
handle: function (action) {
- switch (action.actionType) {
- case ActionTypes.EVENTLOG_ADD:
- this.emit("new_message", action.message);
+ switch (action.type) {
+ case ActionTypes.ADD_EVENT:
+ this.emit(ActionTypes.ADD_EVENT, action.data);
break;
default:
return;
diff --git a/web/src/js/stores/settingstore.js b/web/src/js/stores/settingstore.js
index 0ba7d800..7eef9b8f 100644
--- a/web/src/js/stores/settingstore.js
+++ b/web/src/js/stores/settingstore.js
@@ -13,8 +13,8 @@ _.extend(_SettingsStore.prototype, EventEmitter.prototype, {
return this.settings;
},
handle: function (action) {
- switch (action.actionType) {
- case ActionTypes.SETTINGS_UPDATE:
+ switch (action.type) {
+ case ActionTypes.UPDATE_SETTINGS:
this.settings = action.settings;
this.emit("change");
break;