Created
June 19, 2015 19:03
-
-
Save jhta/13b9e0f93229fb62faf5 to your computer and use it in GitHub Desktop.
dispatcher
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
var Dispatcher = require('flux').Dispatcher; | |
var assign = require('object-assign'); | |
var n = 0; | |
var Dispatcher = assign( new Dispatcher(), { | |
handleViewAction( action ) { | |
n++; | |
// console.log(`dispatch #${n}`,action.type); | |
var payload = { | |
source : 'VIEW_ACTION', | |
action : action | |
}; | |
// console.log(payload); | |
this.dispatch(payload); | |
}, | |
handleServerAction( action ) { | |
n++; | |
// console.log(`dispatch server #${n}`,action.type); | |
var payload = { | |
source: 'SERVER_ACTION', | |
action: action | |
} | |
this.dispatch(payload); | |
} | |
}); | |
module.exports = Dispatcher; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment