dispose Function
Convenience function for disposing of a disposable object that may be undefined. This is primarily used to simplify implementations of IDisposable.dispose. As a simple example:
class Disposable implements IDisposable {
public member1?: DisposableType1;
public member2?: DisposableType2;
public dispose() {
this.member1 = dispose(this.member1); // If member1 is defined, dispose of it and set it to undefined.
this.member2 = dispose(this.member2); // Likewise for member2.
}
}
dispose(disposable?: IDisposable): undefined
Parameter | Type | Description |
---|---|---|
disposable | IDisposable | The object to be disposed of. |
Returns - undefined
undefined
Defined in
- core/bentley/src/Disposable.ts Line 58
Last Updated: 20 June, 2023