首页 > 其他 > 详细

[Flux] 2. Overview and Dispatchers

时间:2015-09-04 17:03:51      阅读:249      评论:0      收藏:0      [点我收藏+]

技术分享

Flux has four major components: Stores, Dispatchers, Views, and Actions. These components interact less like a typical MVC and more like an Event Bus. 

 

src/js/dispatchers/app-dispatcher.js

var Dispatcher = require(‘flux‘).Dispatcher,
    assign = require(‘react/lib/Object.assign‘);

var AppDispatcher = assign(new Dispatcher(), {
    handleViewAction: function (action) {
        this.dispatch({
            source: ‘VIEW_ACTION‘,
            action: action
        });
    }
});

module.exports = AppDispatcher;

 

[Flux] 2. Overview and Dispatchers

原文:http://www.cnblogs.com/Answer1215/p/4781910.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!