import type { AnyAsyncFunction, AnyFunctionReturning, ConstructorOf } from "../core.js"; /** * Wraps the given asynchronous function in a new function that will ignore any outcome of * the context as it resolves. * * This can be useful when providing asynchonous event handler to `.addEventlistener()`, * which only expects synchronous functions. * @param context - The asynchronous function to execute. * @returns A function returning nothing. */ export declare const prepareAsyncContext: (context: AnyAsyncFunction) => ( /** * The arguments that our new function was called with. */ ...args: Array) => void; /** * Executes an asynchronous function and resolves with an alternative result * in case the function failed. * @param executable - The asynchronous function to execute. * @param to - The result we want to return when the function errors. * @param filter - An {@linkcode !Error} subclass. If defined, only errors of * this type will be coalesced. * @typeParam TExecutableReturn - The return type of the function. * @typeParam TCoalesce - The type of the object to coalesce to. * @typeParam TFilter - The type of the error filter. * @returns Whatever the function resolved to, or the provided replacement, * in case the function failed. */ export declare const coalesceOnRejection: >(executable: AnyFunctionReturning>, to: TCoalesce, filter?: TFilter) => Promise; /** * Wait a given period before continuing execution. * @param duration - How many milliseconds to wait. * @returns Nothing */ export declare const sleep: (duration: number) => Promise; /** * Executes an asynchronous function and retries the execution if it rejects. * @param executable - The asynchronous function to execute. * @param retryDelay - The duration to wait after a failed execution. * @param retryCount - How often should the execution be retried? * @typeParam TExecutableReturn - The return type of the function. * @returns Whatever the function resolved to. */ export declare const retry: (executable: AnyFunctionReturning>, retryDelay?: number, retryCount?: number) => Promise;