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

clearListeners throws an error when called on an uninitialised emitr #9

Open
avsmithy opened this issue May 12, 2015 · 0 comments
Open
Labels

Comments

@avsmithy
Copy link

clearListeners() does not check for the existence of the _emitterListeners property before calling _emitterListeners.filterAll(). If _emitterListeners is undefined, it throws an error.

clearListeners: function clearListeners(context) {
...
    this._emitterListeners.filterAll(function(record) {
...
}

off() checks for _emitterListeners, so using off(null, null, this), which calls clearListeners(), works as expected.

off: function off(eventIdentifier, callback, context) {
    // not initialised - so no listeners of any kind
    if (this._emitterListeners == null) { return false; }
... 
...
        this.clearListeners(this);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants