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
Constructor | Modifiers | Description |
---|---|---|
(constructor)() | Constructs a new instance of the Deferred class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
isCompleted | boolean | Returns whether the underlying promise has been completed | |
promise | Promise |
Retrieves the underlying promise for the deferred |
Methods
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
Parameter | Type | Description |
---|---|---|
error | any |
Returns:
void
resolve
Resolves the promise
Signature:
resolve(value?: T | PromiseLike<T>): void;
Parameters
Parameter | Type | Description |
---|---|---|
value | T | PromiseLike |
the value to resolve the promise with |
Returns:
void