diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-09-16 21:06:30 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-09-16 21:06:30 +1200 |
commit | e4ee3e0236069873332fff13baefe4f676e289ee (patch) | |
tree | 68ef5c563b125a8790d14d63623c168599a54913 /web/src/js/dispatcher.js | |
parent | 6efe1aa6a92ce7f9f264903e9d27fb5cf6c32bfe (diff) | |
download | mitmproxy-e4ee3e0236069873332fff13baefe4f676e289ee.tar.gz mitmproxy-e4ee3e0236069873332fff13baefe4f676e289ee.tar.bz2 mitmproxy-e4ee3e0236069873332fff13baefe4f676e289ee.zip |
Convert to ES5 inheritance pattern
Diffstat (limited to 'web/src/js/dispatcher.js')
-rw-r--r-- | web/src/js/dispatcher.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/web/src/js/dispatcher.js b/web/src/js/dispatcher.js index 310f9a7f..4f3cce0c 100644 --- a/web/src/js/dispatcher.js +++ b/web/src/js/dispatcher.js @@ -4,24 +4,24 @@ const PayloadSources = { }; - function Dispatcher() {"use strict"; - this.callbacks = []; +function Dispatcher() {"use strict"; + this.callbacks = []; +} +Dispatcher.prototype.register=function(callback) {"use strict"; + this.callbacks.push(callback); +}; +Dispatcher.prototype.unregister=function(callback) {"use strict"; + var index = this.callbacks.indexOf(f); + if (index >= 0) { + this.callbacks.splice(this.callbacks.indexOf(f), 1); } - Dispatcher.prototype.register=function(callback) {"use strict"; - this.callbacks.push(callback); - }; - Dispatcher.prototype.unregister=function(callback) {"use strict"; - var index = this.callbacks.indexOf(f); - if (index >= 0) { - this.callbacks.splice(this.callbacks.indexOf(f), 1); - } - }; - Dispatcher.prototype.dispatch=function(payload) {"use strict"; - console.debug("dispatch", payload); - this.callbacks.forEach(function(callback) { - callback(payload); - }); - }; +}; +Dispatcher.prototype.dispatch=function(payload) {"use strict"; + console.debug("dispatch", payload); + this.callbacks.forEach(function(callback) { + callback(payload); + }); +}; AppDispatcher = new Dispatcher(); |