diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-09-16 00:56:43 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-09-16 00:56:43 +0200 |
commit | 674bc4273e9a2f1a2e41ef977a80219423c7cb51 (patch) | |
tree | b343902da8a0de10f075c46c75f8ad135bc23192 /web/src/js/Dispatcher.es6.js | |
parent | acdd182754625fabcfc2c6ed4bdad8a63bce8ad6 (diff) | |
download | mitmproxy-674bc4273e9a2f1a2e41ef977a80219423c7cb51.tar.gz mitmproxy-674bc4273e9a2f1a2e41ef977a80219423c7cb51.tar.bz2 mitmproxy-674bc4273e9a2f1a2e41ef977a80219423c7cb51.zip |
format javascript
Diffstat (limited to 'web/src/js/Dispatcher.es6.js')
-rw-r--r-- | web/src/js/Dispatcher.es6.js | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/web/src/js/Dispatcher.es6.js b/web/src/js/Dispatcher.es6.js index 6ac17f9f..f1f36cc8 100644 --- a/web/src/js/Dispatcher.es6.js +++ b/web/src/js/Dispatcher.es6.js @@ -1,40 +1,35 @@ const PayloadSources = { - VIEW_ACTION: "VIEW_ACTION", - SERVER_ACTION: "SERVER_ACTION" + VIEW_ACTION: "VIEW_ACTION", + SERVER_ACTION: "SERVER_ACTION" }; class Dispatcher { - - constructor() { - this.callbacks = []; - } - - register(callback){ - this.callbacks.push(callback); - } - - unregister(callback){ - var index = this.callbacks.indexOf(f); - if (index >= 0) { - this.callbacks.splice(this.callbacks.indexOf(f), 1); + constructor() { + this.callbacks = []; + } + register(callback) { + this.callbacks.push(callback); + } + unregister(callback) { + var index = this.callbacks.indexOf(f); + if (index >= 0) { + this.callbacks.splice(this.callbacks.indexOf(f), 1); + } + } + dispatch(payload) { + console.debug("dispatch", payload); + this.callbacks.forEach((callback) => { + callback(payload); + }); } - } - - dispatch(payload){ - console.debug("dispatch", payload); - this.callbacks.forEach((callback) => { - callback(payload); - }); - } - } AppDispatcher = new Dispatcher(); -AppDispatcher.dispatchViewAction = function(action){ - action.actionSource = PayloadSources.VIEW_ACTION; - this.dispatch(action); +AppDispatcher.dispatchViewAction = function(action) { + action.actionSource = PayloadSources.VIEW_ACTION; + this.dispatch(action); }; -AppDispatcher.dispatchServerAction = function(action){ - action.actionSource = PayloadSources.SERVER_ACTION; - this.dispatch(action); +AppDispatcher.dispatchServerAction = function(action) { + action.actionSource = PayloadSources.SERVER_ACTION; + this.dispatch(action); };
\ No newline at end of file |