Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventEmitter has no .off method #8

Open
EricSimons opened this issue Mar 25, 2015 · 0 comments
Open

EventEmitter has no .off method #8

EricSimons opened this issue Mar 25, 2015 · 0 comments

Comments

@EricSimons
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant