Skip to main content
Module

x/timers/mod.ts>timeout

All timing functions you need - for Deno and the browser
Go to Latest
function timeout
import { timeout } from "https://deno.land/x/timers@v0.2.0/mod.ts";

A typed version of setTimeout

Examples

Example 1

import { timeout } from "https://deno.land/x/timers@v0.2.0/mod.ts";

const timeout = timeout(() => {
  console.log("in 30 days");
}, "30 days");

Type Parameters

optional
T extends any[] = any[]

Parameters

cb: Listener<T>

the callback to call

optional
delay: number | string

the delay as string containing the time in a human readable format (e.g. "1 day and 3hours") or a number of in milliseconds

optional
options: TimeoutOptions<T> = [UNSUPPORTED]