API improvement: make registerConnectionEventProvider return disposable (#11880)

* promote api to official

* add comments

* disposable

* move getConnection out

* comment for connection namespace

* remove extra line

* also fix registerQueryInfoHandler
This commit is contained in:
Alan Ren
2020-10-12 14:29:48 -07:00
committed by GitHub
parent 108891ba2e
commit bc3527d310
8 changed files with 81 additions and 28 deletions

View File

@@ -13,21 +13,39 @@ declare module 'azdata' {
* Namespace for connection management
*/
export namespace connection {
/**
* Supported connection event types
*/
export type ConnectionEventType =
| 'onConnect'
| 'onDisconnect'
| 'onConnectionChanged';
/**
* Connection Event Lister
*/
export interface ConnectionEventListener {
/**
* Connection event handler
* @param type Connection event type
* @param ownerUri Connection's owner uri
* @param args Connection profile
*/
onConnectionEvent(type: ConnectionEventType, ownerUri: string, args: IConnectionProfile): void;
}
/**
* Register a connection event listener
* @param listener The connection event listener
*/
export function registerConnectionEventListener(listener: connection.ConnectionEventListener): void;
export function registerConnectionEventListener(listener: connection.ConnectionEventListener): vscode.Disposable;
export function getConnection(uri: string): Thenable<ConnectionProfile>;
/**
* Get connection profile by its owner uri
* @param ownerUri The owner uri of the connection
* @returns Promise to return the connection profile matching the ownerUri
*/
export function getConnection(ownerUri: string): Thenable<ConnectionProfile>;
}
export namespace nb {