mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
Add connection event listeners (#6540)
This commit is contained in:
@@ -10,6 +10,8 @@ import * as azdata from 'azdata';
|
||||
export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape {
|
||||
|
||||
private _proxy: MainThreadConnectionManagementShape;
|
||||
private _nextListenerHandle: number = 0;
|
||||
private _connectionListeners = new Map<number, azdata.connection.ConnectionEventListener>();
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext
|
||||
@@ -22,6 +24,19 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
|
||||
return this._proxy.$getCurrentConnectionProfile();
|
||||
}
|
||||
|
||||
public $onConnectionEvent(handle: number, type: azdata.connection.ConnectionEventType, ownerUri: string, profile: azdata.IConnectionProfile): void {
|
||||
let listener = this._connectionListeners[handle];
|
||||
if (listener) {
|
||||
listener.onConnectionEvent(type, ownerUri, profile);
|
||||
}
|
||||
}
|
||||
|
||||
public $registerConnectionEventListener(providerId: string, listener: azdata.connection.ConnectionEventListener): void {
|
||||
this._connectionListeners[this._nextListenerHandle] = listener;
|
||||
this._proxy.$registerConnectionEventListener(this._nextListenerHandle, providerId);
|
||||
this._nextListenerHandle++;
|
||||
}
|
||||
|
||||
public $getConnections(activeConnectionsOnly?: boolean): Thenable<azdata.connection.ConnectionProfile[]> {
|
||||
return this._proxy.$getConnections(activeConnectionsOnly);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user