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

ParameterDescription
T

Constructors

ConstructorAlertsDescription
(constructor)()BetaConstructs a new instance of the Deferred class

Properties

PropertyAlertsModifiersTypeDescription
isCompletedBetareadonlybooleanReturns whether the underlying promise has been completed
promiseBetareadonlyPromise<T>Retrieves the underlying promise for the deferred

Methods

MethodAlertsReturn TypeDescription
reject(error)BetavoidRejects the promise
resolve(value)BetavoidResolves 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

ParameterTypeDescription
errorany

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

ParameterTypeDescription
valueT | PromiseLike<T>the value to resolve the promise with