@samitouri / QOS-React-2 / commits / f8d0291874

Fix doc typo and remove underscore from local var

Joshua Ma committed May 23, 2014 at 12:34 UTC f8d029187407bab8028bf8ac4d24f29937cdd6bd
2 files changed +13 -13
docs/docs/flux-todo-list.md
+7 -7
@@ -93,12 +93,12 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
93 */
94 dispatch: function(payload) {
95 // First create array of promises for callbacks to reference.
96 - var _resolves = [];
97 - var _rejects = [];
96 + var resolves = [];
97 + var rejects = [];
98 _promises = _callbacks.map(function(_, i) {
99 return new Promise(function(resolve, reject) {
100 - _resolves[i] = resolve;
101 - _rejects[i] = reject;
100 + resolves[i] = resolve;
101 + rejects[i] = reject;
102 });
103 });
104 // Dispatch to callbacks and resolve/reject promises.
@@ -106,9 +106,9 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
106 // Callback can return an obj, to resolve, or a promise, to chain.
107 // See waitFor() for why this might be useful.
108 Promise.resolve(callback(payload)).then(function() {
109 - _resolves[i](payload);
109 + resolves[i](payload);
110 }, function() {
111 - _rejects[i](new Error('Dispatcher callback unsuccessful'));
111 + rejects[i](new Error('Dispatcher callback unsuccessful'));
112 });
113 });
114 _promises = [];
@@ -591,7 +591,7 @@ Adding Dependency Management to the Dispatcher
591
592 As I said previously, our Dispatcher implementation is a bit naive. It's pretty good, but it will not suffice for most applications. We need a way to be able to manage dependencies between Stores. Let's add that functionality with a waitFor() method within the main body of the Dispatcher class.
593
594 -We'll need another public method, waitFor(). Note that it return a Promise that can in turn be returned from the Store callback.
594 +We'll need another public method, waitFor(). Note that it returns a Promise that can in turn be returned from the Store callback.
595
596 ```javascript
597 /**
examples/todomvc-flux/js/dispatcher/Dispatcher.js
+6 -6
@@ -46,12 +46,12 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
46 */
47 dispatch: function(payload) {
48 // First create array of promises for callbacks to reference.
49 - var _resolves = [];
50 - var _rejects = [];
49 + var resolves = [];
50 + var rejects = [];
51 _promises = _callbacks.map(function(_, i) {
52 return new Promise(function(resolve, reject) {
53 - _resolves[i] = resolve;
54 - _rejects[i] = reject;
53 + resolves[i] = resolve;
54 + rejects[i] = reject;
55 });
56 });
57 // Dispatch to callbacks and resolve/reject promises.
@@ -59,9 +59,9 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
59 // Callback can return an obj, to resolve, or a promise, to chain.
60 // See waitFor() for why this might be useful.
61 Promise.resolve(callback(payload)).then(function() {
62 - _resolves[i](payload);
62 + resolves[i](payload);
63 }, function() {
64 - _rejects[i](new Error('Dispatcher callback unsuccessful'));
64 + rejects[i](new Error('Dispatcher callback unsuccessful'));
65 });
66 });
67 _promises = [];