Also fixed bug when validating a tx with no value.feature/default_network_editable
parent
b1cd7ebc47
commit
bfea26d3e3
@ -0,0 +1,25 @@ |
|||||||
|
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