IDisposable Interface
Base interface for objects that require lifetime management via explicit disposal.
Signature
/** @sealed */
export interface IDisposable
Remarks
This is sealed to reserve the ability to add Symbol.dispose
and thus extend TypeScript's Disposable in the future as a non breaking change.
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
disposed | readonly |
boolean | Whether or not the object has been disposed. If true, the object should be considered invalid, and its other state should be disregarded. |
Methods
Method | Return Type | Description |
---|---|---|
dispose(error) | void | Dispose of the object and its resources. |
Property Details
disposed
Whether or not the object has been disposed. If true, the object should be considered invalid, and its other state should be disregarded.
Signature
readonly disposed: boolean;
Type: boolean
Method Details
dispose
Dispose of the object and its resources.
Signature
dispose(error?: Error): void;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
error | optional | Error | Optional error indicating the reason for the disposal, if the object was disposed as the result of an error. |