Skip to content

EventEmitter has no .off method #8

@EricSimons

Description

@EricSimons

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions