Skip to content

Instantly share code, notes, and snippets.

@tribou
Last active August 29, 2015 14:23
Show Gist options
  • Save tribou/8a477c4d2b6749cb1983 to your computer and use it in GitHub Desktop.
Save tribou/8a477c4d2b6749cb1983 to your computer and use it in GitHub Desktop.
Todo app dispatcher for React and Flux architecture
// Todo app dispatcher with actions responding to both
// view and server actions
var Dispatcher = require('flux').Dispatcher;
var AppDispatcher = new Dispatcher();
AppDispatcher.handleViewAction = function(action) {
this.dispatch({
source: 'VIEW_ACTION',
action: action
});
}
AppDispatcher.handleServerAction = function(action) {
this.dispatch({
source: 'SERVER_ACTION',
action: action
});
}
module.exports = AppDispatcher;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment