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

x/ayonli_jsext/promise/index.ts>until

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

Blocks the current routine until the test returns a truthy value, which is not false, null or undefined. If the test throws an error, it will be treated as a falsy value and the check continues.

This functions returns the same result as the test function when passed.

Examples

Example 1

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

// wait for the header element to be present in the DOM
const ele = await until(() => document.querySelector("header"));

Parameters

test: () => T | PromiseLike<T>

Returns

Promise<T extends false | null | undefined ? never : T>