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

x/ayonli_jsext/promise/index.ts>after

A JavaScript extension package for building strong and modern applications.
Latest
function after
import { after } from "https://deno.land/x/ayonli_jsext@v0.9.72/promise/index.ts";

Resolves a promise only after the given duration.

Examples

Example 1

import { after } from "@ayonli/jsext/async";

const task = fetch("https://example.com")
const res = await after(task, 1000);

console.log(res); // the response will not be printed unless 1 second has passed

Parameters

task: PromiseLike<T>
ms: number

Returns

Promise<T>