Interface for components that require explicit closure.
For components that require opening as well as closing use IOpenable interface instead.
IOpenable
Closer
class MyConnector implements ICloseable { private _client: any = null; ... // The _client can be lazy created public close(correlationId: string, callback: (err: any) => void): void { if (this._client != null) { this._client.close(); this._client = null; } callback(null); } }
Closes component and frees used resources.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Generated using TypeDoc
Interface for components that require explicit closure.
For components that require opening as well as closing use IOpenable interface instead.
IOpenable
Closer
Example
class MyConnector implements ICloseable { private _client: any = null; ... // The _client can be lazy created public close(correlationId: string, callback: (err: any) => void): void { if (this._client != null) { this._client.close(); this._client = null; } callback(null); } }