Comparing version 5.3.0-beta.45 to 5.3.0-beta.46
{ | ||
"name": "xterm", | ||
"description": "Full xterm terminal, in your browser", | ||
"version": "5.3.0-beta.45", | ||
"version": "5.3.0-beta.46", | ||
"main": "lib/xterm.js", | ||
@@ -6,0 +6,0 @@ "style": "css/xterm.css", |
@@ -53,2 +53,38 @@ /** | ||
export class MutableDisposable<T extends IDisposable> implements IDisposable { | ||
private _value?: T; | ||
private _isDisposed = false; | ||
/** | ||
* Gets the value if it exists. | ||
*/ | ||
public get value(): T | undefined { | ||
return this._isDisposed ? undefined : this._value; | ||
} | ||
/** | ||
* Sets the value, disposing of the old value if it exists. | ||
*/ | ||
public set value(value: T | undefined) { | ||
if (this._isDisposed || value === this._value) { | ||
return; | ||
} | ||
this._value?.dispose(); | ||
this._value = value; | ||
} | ||
/** | ||
* Resets the stored value and disposes of the previously stored value. | ||
*/ | ||
public clear(): void { | ||
this.value = undefined; | ||
} | ||
public dispose(): void { | ||
this._isDisposed = true; | ||
this._value?.dispose(); | ||
this._value = undefined; | ||
} | ||
} | ||
/** | ||
@@ -55,0 +91,0 @@ * Wrap a function in a disposable. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2344106
24436