Instantly share code, notes, and snippets.

What would you like to do?
// this creates 'load', 'load.completed' and 'load.failed'
var Actions = Reflux.createActions({
"load": {children: ["completed","failed"]},
// called before the 'load' action emits an event
Actions.load.preEmit = function() {
// called after preEmit
Actions.load.shouldEmit = function(isFail) {
console.log('isFail:' + isFail);
return !isFail;
// when 'load' is triggered, call async operation and trigger related actions
Actions.load.listen(function(isFail) {
// By default, the listener is bound to the action
// so we can access child actions using 'this'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment