import pTimeout from "https://deno.land/x/[email protected]/mod.ts"
const delayedPromise = new Promise(resolve => setTimeout(resolve, 500))
await pTimeout({
promise: delayedPromise,
milliseconds: 50,
})
// => [TimeoutError: Promise timed out after 50 milliseconds]- HUGE thanks to @sindresorhus -- this repository is mostly his code, modified to work with Deno
- Promise Timeout is licensed under the MIT license.
- Code is adapted from Sindre's p-timeout for node (also under the MIT license)