Skip to main content

Benji's personal standard library. Collection of tools for manipulating strings, async iterables, shell scripting, and common data structures.

This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
76%
Published
3 weeks ago (1.5.1)
function wait
wait(timeout: number): Promise<void>

Promise that resolves after timeout, optionally with a value to resolve with.

Examples

Example 1

// Play hide and seek, count to 100 (seconds) // Both methods are identical wait(100e3).then(() => "Ready or not, here I come!").then(seek) wait(100e3, "Ready or not, here I come!").then(seek)

Parameters

timeout: number

Return Type

Promise<void>
wait<T>(
timeout: number,
resolveWith: T,
): Promise<T>

Type Parameters

Parameters

timeout: number
resolveWith: T

Return Type

Add Package

deno add @mindfulminun/pear

Import symbol

import { wait } from "@mindfulminun/pear/core/async";

---- OR ----

Import directly with a jsr specifier

import { wait } from "jsr:@mindfulminun/pear/core/async";

Add Package

npx jsr add @mindfulminun/pear

Import symbol

import { wait } from "@mindfulminun/pear/core/async";

Add Package

yarn dlx jsr add @mindfulminun/pear

Import symbol

import { wait } from "@mindfulminun/pear/core/async";

Add Package

pnpm dlx jsr add @mindfulminun/pear

Import symbol

import { wait } from "@mindfulminun/pear/core/async";

Add Package

bunx jsr add @mindfulminun/pear

Import symbol

import { wait } from "@mindfulminun/pear/core/async";