在TodoStore.js的第107行:
/**
* @param {function} callback
*/
addChangeListener: function(callback) {
this.on(CHANGE_EVENT, callback);
},
link:https://github.com/facebook/flux/blob/master/examples/flux-todomvc/js/stores/TodoStore.js
答案 0 :(得分:2)
该示例使用Node Events module,它定义了EventEmitter。显示正在发生的事情的两条线是:
var EventEmitter = require('events').EventEmitter;
和...
var TodoStore = assign({}, EventEmitter.prototype, {