diff options
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); }; |