From 42a2b28a49d36d3937a4455be343972cb1b28783 Mon Sep 17 00:00:00 2001 From: Christian Alfoni Date: Thu, 25 Sep 2014 11:54:52 +0200 Subject: [PATCH] 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. --- docs/flux-todo-list.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/docs/flux-todo-list.md b/docs/flux-todo-list.md index 2f3e4953..463c56cd 100644 --- a/docs/flux-todo-list.md +++ b/docs/flux-todo-list.md @@ -147,23 +147,19 @@ Now we are all set to create a dispatcher that is more specific to our app, whic ```javascript var Dispatcher = require('./Dispatcher'); -var merge = require('react/lib/merge'); - -var AppDispatcher = merge(Dispatcher.prototype, { +var AppDispatcher = new Dispatcher(); - /** +/** * A bridge function between the views and the dispatcher, marking the action * as a view action. Another variant here could be handleServerAction. * @param {object} action The data coming from the view. */ - handleViewAction: function(action) { - this.dispatch({ - source: 'VIEW_ACTION', - action: action - }); - } - -}); +AppDispatcher.handleViewAction = function(action) { + this.dispatch({ + source: 'VIEW_ACTION', + action: action + }); +}; module.exports = AppDispatcher; ```