0.2.3 • Published 8 years ago

easy-flux v0.2.3

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

flux

基于facebook官方flux模型,进行了一些整理和加工,隐藏了dispatcher,简化了flux的操作流程;

Quick start

Action

create your action:

var Action = Flux.createAction( function(resolve){
    return {
        do_soming: function(){
            return webutils.xxx.done(function(data){
                resolve(data);
            });
        },
        ...
    };
});

Store

create your store:

var Store = Flux.createStore( function(){
    return {
        do_soming: function(data){
            //processing..
            return data;
        },
        ...
    };
});

React

in your component:

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
}
...
})

tips

打开控制台,或许能帮到你!

Examples

Basic example: TodoMVC

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago