This commit is contained in:
Harvey Zack committed 2018-10-19 16:57:31 +08:00
1 parent f58684991f
commit e988f00cf8
15 files changed
+538 -140

No files matched your search

+11 -2
View File
@@ -6,10 +6,19 @@ export default class Events {
}
proxy(target, name, callback, option = {}) {
if (Array.isArray(name)) {
name.forEach(item => this.proxy(target, item, callback, option));
}
target.addEventListener(name, callback, option);
this.destroyEvents.push(() => {
const destroy = () => {
target.removeEventListener(name, callback, option);
});
};
this.destroyEvents.push(destroy);
return destroy;
}
destroy() {