flux-getting-started icon indicating copy to clipboard operation
flux-getting-started copied to clipboard

EventEmitter has no .off method

Open EricSimons opened this issue 10 years ago • 0 comments

Sorry about the bad PR, had a few mins tonight to investigate and it looks like the issue is that .off should actually be .removeListener (doesn't seem to be an off method listed in the docs: https://nodejs.org/api/events.html). I also changed .on to . addListener for consistency

    addChangeListener: function (callback) {
        this.on('change', callback);
    },
    removeChangeListener: function (callback) {
        this.off('change', callback);
    },

To:

    addChangeListener: function (callback) {
        this.addListener('change', callback);
    },
    removeChangeListener: function (callback) {
        this.removeListener('change', callback);
    },

All in all, great course, absolutely loved it! I only realized that this was a bug after I started building more features on top of it, and the messages component wouldn't unmount properly :)

EricSimons avatar Mar 25 '15 09:03 EricSimons