debian-mirror-gitlab/app/assets/javascripts/ide/lib/common/disposable.js
2018-03-17 18:26:18 +05:30

14 lines
289 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();
}
}