function deadline
deadline<T>(): Promise<T>Create a promise which will be rejected with DeadlineError when
a given delay is exceeded.
Note: Prefer to use AbortSignal.timeout instead for the APIs
that accept AbortSignal.
Examples
Example 1
Example 1
import { deadline } from "@std/async/deadline"; import { delay } from "@std/async/delay"; const delayedPromise = delay(1000); // Below throws `DeadlineError` after 10 ms const result = await deadline(delayedPromise, 10);
Type Parameters
T