0.2.0 • Published 4 years ago

@byungi/p-timeout v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@byungi/p-timeout

Promise timeout after a specified time.

Example

import pTimeout, {TimeoutError} from '@byungi/p-timeout'

pTimeout(pDelay(1000), 500) // After 500ms, delay promise is timeout.
    .catch(err => {
        console.log(err.isTimeout) // => true
        console.log(err instanceof TimeoutError) // => true
    })

API

pTimeout(promise, ms)

Wrap promise to timeout if input promise takes longer than the specified time.

License

MIT

0.2.0

4 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago