import { timeout } from "https://deno.land/x/ayonli_jsext@v0.9.72/promise/index.ts";
Try to resolve a promise with a timeout limit.
Examples
Example 1
Example 1
import { timeout, sleep } from "@ayonli/jsext/async";
const task = sleep(1000);
await timeout(task, 500); // throws TimeoutError after 500ms
Parameters
task: PromiseLike<T>