LazyPromise Class
Packages > @fluidframework/common-utils > LazyPromise
A lazy evaluated promise. The execute function is delayed until the promise is used, e.g. await, then, catch … The execute function is only called once. All calls are then proxied to the promise returned by the execute method.
Signature:
export declare class LazyPromise<T> implements Promise<T>
Implements: Promise<T>
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(execute) | Constructs a new instance of the LazyPromise class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
[Symbol.toStringTag] | string |
Methods
Method | Modifiers | Description |
---|---|---|
catch(onrejected) | ||
finally(onfinally) | ||
then(onfulfilled, onrejected) |
Constructors
LazyPromise.(constructor)
Constructs a new instance of the LazyPromise
class
Signature:
constructor(execute: () => Promise<T>);
Parameters
Parameter | Type | Description |
---|---|---|
execute | () => Promise |
Properties
[Symbol.toStringTag]
Signature:
get [Symbol.toStringTag](): string;
Methods
catch
Signature:
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<T | TResult>;
Parameters
Parameter | Type | Description |
---|---|---|
onrejected | ((reason: any) => TResult | PromiseLike |
Returns:
Promise<T | TResult>
finally
Signature:
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
Parameters
Parameter | Type | Description |
---|---|---|
onfinally | (() => void) | null | undefined |
Returns:
Promise<T>
then
Signature:
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
Parameters
Parameter | Type | Description |
---|---|---|
onfulfilled | ((value: T) => TResult1 | PromiseLike |
|
onrejected | ((reason: any) => TResult2 | PromiseLike |
Returns:
Promise<TResult1 | TResult2>