npm

Need private packages and team management tools?Check out npm Orgs. »

This package has been deprecated

Author message:

Deprecated

typescript-promise

0.2.0 • Public • Published

typescript-promise

Simple promise implementation in TypeScript

Provides just basic API and for clarity it's free from any micro and macro optimizations.

It's also proof of concept of how straightforward promise implementation can be with its design centered around done method.

Can safely be used in projects where code size is important, it's definitely one of the smallest promise implementations.

Total lib size is under 800 bytes gzipped.

Things not covered in this implementation:

Rejection in case of circular resolution

Circular resolution of promises is in most cases result of a bug. Promise/A+ demands to throw TypeError when such action occurs. It's not in effect (at least currently) in ECMAScript 6 version. This implementation to stay away from additional complexity does not handle that as well. Resolving promise with itself leaves promise resolved but in forever locked unsettled state.

Support for foreign promises (thenables)

Promise/A+ requires support for foreign (not coming from same implementation) promise objects, it's also specified behavior for ECMAScript 6 promises. Foreign promises assimilation is tricky and to make sure things won't break (by really unexpected type of implementation) involves numerous security steps. This logic is not important to understand how promises work, so to keep things simple, this library recognizes just own promises.

install

npm i typescript-promise

Downloadsweekly downloads

3

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability