Files
azuredatastudio/extensions/big-data-cluster/src/common/promise.ts
Charles Gagnon 7e5b864299 BDC Dashboard connection retry (#7784)
* Open cluster dashboard

* Remove old translated strings and update var name

* Add exported auth type

* Add newline

* Add connection retry for dashboard

* Change getMainSectionComponent to return multiple (no undefined)

* Move try/catch to withConnectRetry

* Add connection retry for dashboard

* Change getMainSectionComponent to return multiple (no undefined)

* Move try/catch to withConnectRetry
2019-10-19 15:42:49 -07:00

26 lines
1.1 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Deferred promise
*/
export class Deferred<T> {
promise: Promise<T>;
resolve: (value?: T | PromiseLike<T>) => void;
reject: (reason?: any) => void;
constructor() {
this.promise = new Promise<T>((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult> {
return this.promise.then(onfulfilled, onrejected);
}
}