@lenic/deferred
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

Deferred

Similar to jQuery's Deferred, but it's a promise wrapper.

Useage

import { Deferred } from "@lenic/deferred";

const deferred = new Deferred<string>();

deferred.promise.then(
  (v) => console.log(v),
  (e) => console.error(e)
);

deferred.resolve("hello world"); // then: hello world
deferred.reject("error message"); // catch: error message

Readme

Keywords

Package Sidebar

Install

npm i @lenic/deferred

Weekly Downloads

0

Version

2.1.1

License

MIT

Unpacked Size

9.16 kB

Total Files

10

Last publish

Collaborators

  • lenic