debian-mirror-gitlab/app/assets/javascripts/ide/lib/common/disposable.js
2018-05-09 12:01:36 +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();
}
}