Created
February 1, 2015 03:51
-
-
Save paulstatezny/67d0c19bce1709a7d8b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 0b1b114f5824be2fd4feb26eddfbb349813971cb Mon Sep 17 00:00:00 2001 | |
From: Paul Statezny <[email protected]> | |
Date: Sat, 31 Jan 2015 20:49:49 -0700 | |
Subject: [PATCH] Create new dispatcher upon dispatch. | |
--- | |
lib/dispatcher.js | 6 ++++++ | |
1 file changed, 6 insertions(+) | |
diff --git a/lib/dispatcher.js b/lib/dispatcher.js | |
index a5cc50c..b72b889 100644 | |
--- a/lib/dispatcher.js | |
+++ b/lib/dispatcher.js | |
@@ -28,6 +28,12 @@ Dispatcher.prototype.addStore = function(name, store) { | |
}; | |
Dispatcher.prototype.dispatch = function(action) { | |
+ var dispatcher = new Dispatcher(this.stores); | |
+ | |
+ dispatcher._dispatch(action); | |
+}; | |
+ | |
+Dispatcher.prototype._dispatch = function(action) { | |
if (!action || !action.type) { | |
throw new Error("Can only dispatch actions with a 'type' property"); | |
} | |
-- | |
2.0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment