mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Use new Fluent-based Resource Tree for all environments (#1841)
Co-authored-by: Laurent Nguyen <laurent.nguyen@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
cebf044803
commit
98c5fe65e6
18
src/Utils/PromiseSource.ts
Normal file
18
src/Utils/PromiseSource.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export default class PromiseSource<T = void> {
|
||||
promise: Promise<T>;
|
||||
resolve: (value: T) => void;
|
||||
reject: (reason?: unknown) => void;
|
||||
|
||||
constructor() {
|
||||
this.promise = new Promise((resolve, reject) => {
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
});
|
||||
}
|
||||
|
||||
/** Resolves the promise, then gets off the thread and waits until the currently-registered 'then' callback run. */
|
||||
async resolveAndWait(value: T): Promise<T> {
|
||||
this.resolve(value);
|
||||
return await this.promise;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user