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; return;
} }
// Function. // Function.
const lists = []; if (!(type in this.$$events)) {
if ((type in this.$$events)) { return;
lists.push(this.$$events);
} }
const listeners = this.$$events; this.$$events[type] = this.$$events[type].filter((listener) => {
listeners[type] = listeners[type].filter((listener) => {
return listener.fn !== fn; return listener.fn !== fn;
}); });
} }