Skip to content

promise

Utils for working with promises.

Promises are used in JavaScript to handle asynchronous operations. They are a way to handle the result of an asynchronous operation once it completes.

You can await the completion of a promise using the await keyword. This will pause the execution of the current function until the promise resolves.

Functions

animationFrame()

function animationFrame(n?): Promise<void>

Parameters

n?: number

Returns

Promise<void>

Defined in

tmp/commons/src/lib/utils/promise.ts:19


sleep()

function sleep(ms?): Promise<unknown>

Returns a promise that resolves after a delay.

Parameters

ms?: number

the number of miliseconds to wait before resolving the promise. Defaults to 0.

Returns

Promise<unknown>

Promise that resolves after the specified delay.

Defined in

tmp/commons/src/lib/utils/promise.ts:15