@samitouri / QOS-React-2 / commits / 1b6a3d5215

Update flux-todo-list.md

You have to instantiate a Dispatcher to use it, not just grab the prototype or it will fail when trying to grab instance properties like: this.$Dispatcher._callbacks.

Christian Alfoni committed Sep 25, 2014 at 11:54 UTC 1b6a3d521508d1480538505e624df40668935754
1 file changed +8 -12
docs/docs/flux-todo-list.md
+8 -12
@@ -147,23 +147,19 @@ Now we are all set to create a dispatcher that is more specific to our app, whic
147 ```javascript
148 var Dispatcher = require('./Dispatcher');
149
150 -var merge = require('react/lib/merge');
151 -
152 -var AppDispatcher = merge(Dispatcher.prototype, {
150 +var AppDispatcher = new Dispatcher();
151
154 - /**
152 +/**
153 * A bridge function between the views and the dispatcher, marking the action
154 * as a view action. Another variant here could be handleServerAction.
155 * @param {object} action The data coming from the view.
156 */
159 - handleViewAction: function(action) {
160 - this.dispatch({
161 - source: 'VIEW_ACTION',
162 - action: action
163 - });
164 - }
165 -
166 -});
157 +AppDispatcher.handleViewAction = function(action) {
158 + this.dispatch({
159 + source: 'VIEW_ACTION',
160 + action: action
161 + });
162 +};
163
164 module.exports = AppDispatcher;
165 ```