Created
October 15, 2015 01:07
-
-
Save tribou/8716639aa77f232c4a2e to your computer and use it in GitHub Desktop.
A sample Flux dispatcher implemented in an ES6 class
This file contains 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
// Todo app dispatcher with actions responding to both | |
// view and server actions | |
import { Dispatcher } from 'flux'; | |
class DispatcherClass extends Dispatcher { | |
handleViewAction(action) { | |
this.dispatch({ | |
source: 'VIEW_ACTION', | |
action: action, | |
}); | |
} | |
handleServerAction(action) { | |
this.dispatch({ | |
source: 'SERVER_ACTION', | |
action: action, | |
}); | |
} | |
} | |
const AppDispatcher = new DispatcherClass(); | |
export default AppDispatcher; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment