Skip to main content

Deferred Class

A deferred creates a promise and the ability to resolve or reject it \

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/core-utils/legacy.

For more information about our API support guarantees, see here.

Signature

export declare class Deferred<T>

Type Parameters

Parameter Description
T

Constructors

Constructor Alerts Description
(constructor)() Beta Constructs a new instance of the Deferred class

Properties

Property Alerts Modifiers Type Description
isCompleted Beta readonly boolean Returns whether the underlying promise has been completed
promise Beta readonly Promise<T> Retrieves the underlying promise for the deferred

Methods

Method Alerts Return Type Description
reject(error) Beta void Rejects the promise
resolve(value) Beta void Resolves the promise

Constructor Details

(constructor)

Constructs a new instance of the Deferred class

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
constructor();

Property Details

isCompleted

Returns whether the underlying promise has been completed

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
get isCompleted(): boolean;

Type: boolean

promise

Retrieves the underlying promise for the deferred

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
get promise(): Promise<T>;

Type: Promise<T>

Method Details

reject

Rejects the promise

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
reject(error: any): void;

Parameters

Parameter Type Description
error any

resolve

Resolves the promise

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
resolve(value: T | PromiseLike<T>): void;

Parameters

Parameter Type Description
value T | PromiseLike<T> the value to resolve the promise with