我在通量示例 todomvc 中找不到 'on' 方法的定义。它有什么作用?

I can't find the definition of the 'on' method in flux example, todomvc. what does it do?

在 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

示例使用的是 Node Events module,它定义了 EventEmitter。向您展示正在发生的事情的两行是:

var EventEmitter = require('events').EventEmitter;

还有……

var TodoStore = assign({}, EventEmitter.prototype, {