UNPKG

dockview

Version:

Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support

39 lines (38 loc) 978 B
export var Disposable; (function (Disposable) { Disposable.NONE = { dispose: () => { // noop }, }; })(Disposable || (Disposable = {})); export class CompositeDisposable { constructor(...args) { this.disposables = args; } static from(...args) { return new CompositeDisposable(...args); } addDisposables(...args) { args === null || args === void 0 ? void 0 : args.forEach((arg) => this.disposables.push(arg)); } dispose() { this.disposables.forEach((arg) => arg.dispose()); } } export class MutableDisposable { constructor() { this._disposable = Disposable.NONE; } set value(disposable) { if (this._disposable) { this._disposable.dispose(); } this._disposable = disposable; } dispose() { if (this._disposable) { this._disposable.dispose(); } } }