debian-mirror-gitlab/app/assets/javascripts/ide/lib/common/disposable.js
2021-03-08 18:12:59 +05:30

14 lines
293 B
JavaScript

export default class Disposable {
constructor() {
this.disposers = new Set();
}
add(...disposers) {
disposers.forEach((disposer) => this.disposers.add(disposer));
}
dispose() {
this.disposers.forEach((disposer) => disposer.dispose());
this.disposers.clear();
}
}