fix: removing nonexistent events is ok

This commit is contained in:
cha0s 2019-05-16 19:30:51 -05:00
parent 2fc0b35eee
commit e97aef03d1

View File

@ -77,12 +77,10 @@ export function EventEmitterMixin(Superclass) {
return;
}
// Function.
const lists = [];
if ((type in this.$$events)) {
lists.push(this.$$events);
if (!(type in this.$$events)) {
return;
}
const listeners = this.$$events;
listeners[type] = listeners[type].filter((listener) => {
this.$$events[type] = this.$$events[type].filter((listener) => {
return listener.fn !== fn;
});
}