Skip to content

Instantly share code, notes, and snippets.

@flarnie
Created December 9, 2014 00:44
Show Gist options
  • Save flarnie/36bc3a6588021e0b4743 to your computer and use it in GitHub Desktop.
Save flarnie/36bc3a6588021e0b4743 to your computer and use it in GitHub Desktop.
Flux TodoApp Sample 5
// 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