Skip to content 

Deferred Class

Packages > @fluidframework/common-utils > Deferred

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

Signature:

export declare class Deferred<T> 

Constructors

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

Properties

List of properties for this class
Property Modifiers Type Description
isCompleted boolean Returns whether the underlying promise has been completed
promise Promise Retrieves the underlying promise for the deferred

Methods

List of methods on this class
Method Modifiers Description
reject(error) Rejects the promise
resolve(value) Resolves the promise

Constructors

Deferred.(constructor)

Constructs a new instance of the Deferred class

Signature:

constructor();

Properties

isCompleted

Returns whether the underlying promise has been completed

Signature:

get isCompleted(): boolean;

promise

Retrieves the underlying promise for the deferred

Signature:

get promise(): Promise<T>;

Methods

reject

Rejects the promise

Signature:

reject(error: any): void;

Parameters

List of parameters
Parameter Type Description
error any

Returns:

void

resolve

Resolves the promise

Signature:

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

Parameters

List of parameters
Parameter Type Description
value T | PromiseLike the value to resolve the promise with

Returns:

void