@creately/future
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Future

Extended version of the Promise class which has resolve and reject methods to resolve or reject the underlying promise.

import { Future } from '@creately/future';

// Returns a promise which resolves after given time
function sleep( ms: number ): Promise<number> {
    const f = new Future<number>();
    setTimeout(() => f.resolve(Date.now()), ms);
    return f;
}

Readme

Keywords

Package Sidebar

Install

npm i @creately/future

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

4.05 kB

Total Files

7

Last publish

Collaborators

  • mehdhi
  • thisunravisara
  • chandika
  • shashik_thiwanka
  • sasindu
  • sajeeva
  • linatrefai
  • damithcgx