fixes #146: add once to EventEmitter
This commit is contained in:
parent
b776b2f3cb
commit
a97406d712
4 changed files with 818 additions and 38 deletions
4
index.js
4
index.js
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue