promise timeout rejection
Reject a promise if it takes more than a set duration.
Installation
$ npm install --save promise-timeout-rejection
...or:
$ yarn add promise-timeout-rejection
Usage
Wrap a promise and define a timeout in milliseconds. If the promise resolves or rejects in that time then it acts in the exact same way as
the original promise, otherwise it's rejected with a specific PromiseTimeOutError
error.
promiseTimeout(promise, timeout)
const promiseTimeout = const pausePromise = // `pausePromise` takes an argument of the amount of milliseconds// it will take to resolve