IDisposable Interface
Base interface for objects that require lifetime management via explicit disposal.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
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.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
readonly disposed: boolean;
Type: boolean
Method Details
dispose
Dispose of the object and its resources.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
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. |