mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 12:41:20 -08:00
add event proxy
This commit is contained in:
1 parent
11bc295663
commit
a395bc4550
7 files changed
+62
-76
No files matched your search
@@ -1,5 +1,14 @@
|
||||
export default class Events {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
this.destroys = [];
|
||||
this.proxy = this.proxy.bind(this);
|
||||
}
|
||||
|
||||
proxy(target, name, callback) {
|
||||
target.addEventListener(name, callback);
|
||||
this.destroys.push(() => {
|
||||
target.removeEventListener(name, callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user