debt - simplify stuff

This commit is contained in:
Johannes Rieken
2017-06-13 16:51:11 +02:00
parent cfd4a2087e
commit cf06cc0739
+7 -1
View File
@@ -41,7 +41,13 @@ export function combinedDisposable(disposables: IDisposable[]): IDisposable {
}
export function toDisposable(...fns: (() => void)[]): IDisposable {
return combinedDisposable(fns.map(fn => ({ dispose: fn })));
return {
dispose() {
for (const fn of fns) {
fn();
}
}
};
}
export abstract class Disposable implements IDisposable {