mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 17:22:45 -05:00
* first few notebookEditor tests * formating fixes * PR feedback * PR feedback * copyright fixes * improve test names and assertion messages * PR feedback * improve test names. * test name change * test name change * remove unneeded cast * remove spurious comment * fix misplaced paranthesis - thanks hygiene checker! * remove unused code * remove deferredPromise * rempve unnecessary mock usage in dispose test * use getContainer for ['parent'] * notebookService needs 9th constructor argument * Add uploading debugging step * remove changes to ci.yml Co-authored-by: Arvind Ranasaria MacPro <arvranmac@MININT-OE7B592.fareast.corp.microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
41 lines
1.6 KiB
TypeScript
41 lines
1.6 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> implements Promise<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<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
|
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
|
|
then(onFulfilled?: any, onRejected?: any) {
|
|
return this.promise.then(onFulfilled, onRejected);
|
|
}
|
|
|
|
catch<TResult = never>(onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
|
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
catch(onRejected?: any) {
|
|
return this.promise.catch(onRejected);
|
|
}
|
|
|
|
finally(onfinally?: () => void): Promise<T> {
|
|
return this.promise.finally(onfinally);
|
|
}
|
|
|
|
get [Symbol.toStringTag](): string {
|
|
return this.promise[Symbol.toStringTag]; // symbol tag same as that of underlying promise object
|
|
}
|
|
}
|