diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-09-17 02:13:37 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-09-17 02:13:37 +0200 |
commit | 51db9a5612f0899ed61751dbee3f4e4b19a74ea4 (patch) | |
tree | b1c7f9950f496c8216050b57b1f0e06c6eeb5424 /web/src/js/dispatcher.js | |
parent | d998790c2f12594e6d0edc5a98e908677b60b31f (diff) | |
download | mitmproxy-51db9a5612f0899ed61751dbee3f4e4b19a74ea4.tar.gz mitmproxy-51db9a5612f0899ed61751dbee3f4e4b19a74ea4.tar.bz2 mitmproxy-51db9a5612f0899ed61751dbee3f4e4b19a74ea4.zip |
formatting
Diffstat (limited to 'web/src/js/dispatcher.js')
-rw-r--r-- | web/src/js/dispatcher.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/web/src/js/dispatcher.js b/web/src/js/dispatcher.js index 4f3cce0c..028ac4dc 100644 --- a/web/src/js/dispatcher.js +++ b/web/src/js/dispatcher.js @@ -4,32 +4,32 @@ const PayloadSources = { }; -function Dispatcher() {"use strict"; +function Dispatcher() { this.callbacks = []; } -Dispatcher.prototype.register=function(callback) {"use strict"; +Dispatcher.prototype.register = function (callback) { this.callbacks.push(callback); }; -Dispatcher.prototype.unregister=function(callback) {"use strict"; +Dispatcher.prototype.unregister = function (callback) { var index = this.callbacks.indexOf(f); if (index >= 0) { this.callbacks.splice(this.callbacks.indexOf(f), 1); } }; -Dispatcher.prototype.dispatch=function(payload) {"use strict"; +Dispatcher.prototype.dispatch = function (payload) { console.debug("dispatch", payload); - this.callbacks.forEach(function(callback) { + this.callbacks.forEach(function (callback) { callback(payload); }); }; AppDispatcher = new Dispatcher(); -AppDispatcher.dispatchViewAction = function(action) { +AppDispatcher.dispatchViewAction = function (action) { action.actionSource = PayloadSources.VIEW_ACTION; this.dispatch(action); }; -AppDispatcher.dispatchServerAction = function(action) { +AppDispatcher.dispatchServerAction = function (action) { action.actionSource = PayloadSources.SERVER_ACTION; this.dispatch(action); }; |