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

List of constructors for this class
Constructor Modifiers Description
(constructor)(execute) Constructs a new instance of the LazyPromise class

Properties

List of properties for this class
Property Modifiers Type Description
[Symbol.toStringTag] string

Methods

List of methods on this class
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

List of 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

List of parameters
Parameter Type Description
onrejected ((reason: any) => TResult | PromiseLike) | null | undefined

Returns:

Promise<T | TResult>

finally

Signature:

finally(onfinally?: (() => void) | null | undefined): Promise<T>;

Parameters

List of 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

List of parameters
Parameter Type Description
onfulfilled ((value: T) => TResult1 | PromiseLike) | null | undefined
onrejected ((reason: any) => TResult2 | PromiseLike) | null | undefined

Returns:

Promise<TResult1 | TResult2>