Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/async.js>timeout

A JavaScript extension package for building strong and modern applications.
Latest
function timeout
import { timeout } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/async.js";

Try to resolve a promise with a timeout limit.

Examples

Example 1

import { timeout, sleep } from "@ayonli/jsext/async";

const task = sleep(1000);

await timeout(task, 500); // throws TimeoutError after 500ms