parent
bfea26d3e3
commit
2564c0c51c
@ -1,25 +0,0 @@ |
||||
module.exports = class ListenerManager { |
||||
|
||||
constructor() { |
||||
this.cleaners = {} |
||||
} |
||||
|
||||
setup (name) { |
||||
if (!(name in this.cleaners)) { |
||||
this.cleaners[name] = [] |
||||
} |
||||
} |
||||
|
||||
addCleanup (name, cleaner) { |
||||
this.setup(name) |
||||
} |
||||
|
||||
cleanupOldListeners (name) { |
||||
this.setup(name) |
||||
this.cleaners[name].forEach((cleaner) => { |
||||
cleaner() |
||||
}) |
||||
this.cleaners[name] = [] |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue