/* https://github.com/spoike/refluxjs#using-the-listener-instance-methods */ // var action1 = Reflux.createAction(), // action2 = Reflux.createAction(), // action3 = Reflux.createAction(), // join = Reflux.joinTrailing(action1,action2,action3); // function hello(data){ // console.log('== hello =='); // console.log(data); // } // Reflux.createStore().listenTo(join,hello); // action1('a'); // action2('b'); // action3('c'); 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var ActionFactory = (function () { function ActionFactory() { _classCallCheck(this, ActionFactory); this.actions = {}; } _createClass(ActionFactory, [{ key: 'createAction', value: function createAction(model) { this.actions[model] = Reflux.createAction(); return this.actions[model]; } }, { key: 'getAction', value: function getAction(model) { return !!this.actions[model] ? this.actions[model] : this.createAction(model); } }]); return ActionFactory; })(); var acF = new ActionFactory(); function hello(data) { console.log('== ' + data + ' =='); } Reflux.createStore().listenTo(acF.getAction('msg'), hello); acF.getAction('msg')('lol');