You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constemitter=Object.create(DOMEmitterMixin);emitter.listenTo(element,'someEvent',callback);emitter.stopListening(element,'someEvent',callback);emitter.stopListening();// TypeError: Cannot read property 'removeListener' of undefined.
This works fine:
constemitter=Object.create(DOMEmitterMixin);emitter.listenTo(element,'someEvent',callback);emitter.stopListening(element,'someEvent');// Without callbackemitter.stopListening();
The text was updated successfully, but these errors were encountered:
This is because parent EmitterMixin.off( event, callback ) removes only specified callback from callbacks array, and keeps event object in memory even if callbacks array is empty (is it expected?).
We can easily fix it by adding condition which prevent from removing non existing listener here or we can consider to improve EmitterMixin.off() to remove event from emitter when callbacks array is empty.
How to reproduce:
This works fine:
The text was updated successfully, but these errors were encountered: