Skip to content

khrj/p-timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

People standing in Timeout illustration

Promise Timeout

Timeout a promise after a specified amount of time. Deno port of sindresorhus's p-timeout for node

build status language code size issues license version

View on deno.land




Usage

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]

API

See https://doc.deno.land/https/deno.land/x/[email protected]/mod.ts

Supporters

  • HUGE thanks to @sindresorhus -- this repository is mostly his code, modified to work with Deno

Stargazers repo roster for @khrj/p-timeout

Forkers repo roster for @khrj/p-timeout

Related

License