From 3792d5494a5d97533be28a12eeae9bc36dea25ad Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 28 Sep 2015 14:48:50 +0100 Subject: [PATCH] Dispatcher should be a global too --- src/dispatcher.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dispatcher.js b/src/dispatcher.js index cd954b573f..67d2944cf8 100644 --- a/src/dispatcher.js +++ b/src/dispatcher.js @@ -24,10 +24,13 @@ class MatrixDispatcher extends flux.Dispatcher { setTimeout(super.dispatch.bind(this, payload), 0); } else { this.dispatching = true; - super.dispatch.call(this, payload); + super.dispatch(payload); this.dispatching = false; } } }; -module.exports = new MatrixDispatcher(); +if (global.mxDispatcher === undefined) { + global.mxDispatcher = new MatrixDispatcher(); +} +module.exports = global.mxDispatcher;