fixes #146: add once to EventEmitter

This commit is contained in:
mcmics 2022-03-23 20:26:24 +01:00
parent b776b2f3cb
commit a97406d712
No known key found for this signature in database
GPG key ID: 1EEBE671E3961601
4 changed files with 818 additions and 38 deletions

View file

@ -31,6 +31,10 @@ class EventEmitter extends EventTarget {
on (type, fn) {
this.addEventListener(type, ({ detail }) => fn.apply(this, detail));
}
once (type, fn) {
this.addEventListener(type, ({ detail }) => fn.apply(this, detail), { once: true });
}
}
class TabGroup extends EventEmitter {