This is just a mix of Dispatcher, EventEmmiter , and some optimization for a better encoding and debugg experience;
npm install easy-flux
``
var Action = Flux.createAction( function(resolve){
return {
do_soming: function(){
return webutils.xxx.done(function(data){
resolve(data);
});
},
...
};
});
`
`
var Store = Flux.createStore( function(){
return {
do_soming: function(data){
//processing..
return data;
},
...
};
});
`
`
var Test = React.createClass({
...
componentDidMount: function(){
this.storeListeners = Store.listen({
'do_soming': this.onDone
});
},
componentWillUnmount: function(){
Store.listenOff(this.storeListeners);
},
onDone: function(data){
//now is your choice
}
...
})
``