timeoutable-promise
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

timeoutable-promise

a timeoutable promise implement

promise is a async task, we do not know when it finished, sometimes we want it oly execute in a time window, add a timeout is needed.

how to use

if it is timeout. will throw a TimeoutError

new Promise((resolve, reject) => {
    reslove()
}, 500) // <-- here is a timeout

or use it as normal promise

new Promise((resolve, reject) => {
    reslove()
}) 

Readme

Keywords

none

Package Sidebar

Install

npm i timeoutable-promise

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

2.5 kB

Total Files

4

Last publish

Collaborators

  • ljx0517