Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.17 KB

Future.md

File metadata and controls

47 lines (31 loc) · 1.17 KB

tiny-futureDocs


tiny-future / Future

Class: Future<T>

A tiny way to make Promise more convenient to use without any dependencies.

Create a new Future which wraps a new Promise.

Example

const future = new Future<number>();
asyncFunc(() => {
    future.resolve(0);
});
return future.promise;

Type Parameters

Type Parameter
T

Constructors

new Future()

new Future<T>(): Future<T>

Returns

Future<T>

Properties

Property Modifier Type Description Defined in
promise readonly Promise<T> The Promise created by the Future. future.ts:31
reject readonly (reason?: any) => void Reject the created Promise. future.ts:26
resolve readonly (value: T | PromiseLike<T>) => void Resolve the created Promise. future.ts:21