Move _isDisposed to Disposable class

This commit is contained in:
Daniel Imms
2018-08-06 07:16:51 -07:00
parent bae3f64c10
commit cbfb99a5cf
2 changed files with 2 additions and 2 deletions
+2
View File
@@ -11,6 +11,7 @@ import { IDisposable } from 'xterm';
*/
export abstract class Disposable implements IDisposable {
protected _disposables: IDisposable[] = [];
protected _isDisposed: boolean = false;
constructor() {
}
@@ -19,6 +20,7 @@ export abstract class Disposable implements IDisposable {
* Disposes the object, triggering the `dispose` method on all registered IDisposables.
*/
public dispose(): void {
this._isDisposed = true;
this._disposables.forEach(d => d.dispose());
this._disposables.length = 0;
}