diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-01-01 16:41:45 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-01-01 16:41:45 +1300 |
commit | b09dbbe20934e0da9fe45e254f74719e5e63423f (patch) | |
tree | 7d2abd0dc249be85393e6523a321fef72a462c0a /web/src/js/store | |
parent | fa77fba37cf2823195a6e40ab0ba0f8bb741d634 (diff) | |
download | mitmproxy-b09dbbe20934e0da9fe45e254f74719e5e63423f.tar.gz mitmproxy-b09dbbe20934e0da9fe45e254f74719e5e63423f.tar.bz2 mitmproxy-b09dbbe20934e0da9fe45e254f74719e5e63423f.zip |
Replace custom EventEmitter with one from browserify
Diffstat (limited to 'web/src/js/store')
-rw-r--r-- | web/src/js/store/store.js | 9 | ||||
-rw-r--r-- | web/src/js/store/view.js | 7 |
2 files changed, 10 insertions, 6 deletions
diff --git a/web/src/js/store/store.js b/web/src/js/store/store.js index 3def7723..5024049f 100644 --- a/web/src/js/store/store.js +++ b/web/src/js/store/store.js @@ -1,6 +1,7 @@ var _ = require("lodash"); var $ = require("jquery"); +var EventEmitter = require('events').EventEmitter; var utils = require("../utils.js"); var actions = require("../actions.js"); @@ -8,10 +9,10 @@ var dispatcher = require("../dispatcher.js"); function ListStore() { - utils.EventEmitter.call(this); + EventEmitter.call(this); this.reset(); } -_.extend(ListStore.prototype, utils.EventEmitter.prototype, { +_.extend(ListStore.prototype, EventEmitter.prototype, { add: function (elem) { if (elem.id in this._pos_map) { return; @@ -57,10 +58,10 @@ _.extend(ListStore.prototype, utils.EventEmitter.prototype, { function DictStore() { - utils.EventEmitter.call(this); + EventEmitter.call(this); this.reset(); } -_.extend(DictStore.prototype, utils.EventEmitter.prototype, { +_.extend(DictStore.prototype, EventEmitter.prototype, { update: function (dict) { _.merge(this.dict, dict); this.emit("recalculate"); diff --git a/web/src/js/store/view.js b/web/src/js/store/view.js index e96d1bcc..b5db9287 100644 --- a/web/src/js/store/view.js +++ b/web/src/js/store/view.js @@ -1,5 +1,8 @@ + +var EventEmitter = require('events').EventEmitter; var _ = require("lodash"); + var utils = require("../utils.js"); function SortByStoreOrder(elem) { @@ -12,7 +15,7 @@ var default_filt = function(elem){ }; function StoreView(store, filt, sortfun) { - utils.EventEmitter.call(this); + EventEmitter.call(this); filt = filt || default_filt; sortfun = sortfun || default_sort; @@ -30,7 +33,7 @@ function StoreView(store, filt, sortfun) { this.recalculate(filt, sortfun); } -_.extend(StoreView.prototype, utils.EventEmitter.prototype, { +_.extend(StoreView.prototype, EventEmitter.prototype, { close: function () { this.store.removeListener("add", this.add); this.store.removeListener("update", this.update); |