Created
December 9, 2014 00:44
-
-
Save flarnie/36bc3a6588021e0b4743 to your computer and use it in GitHub Desktop.
Flux TodoApp Sample 5
This file contains hidden or 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
// The 'handleViewAction' dispatches the action to all stores. | |
// ... | |
var Dispatcher = require('flux').Dispatcher; | |
var assign = require('object-assign'); | |
var AppDispatcher = assign(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 | |
}); | |
} | |
}); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment