/**
 * Awaits the set number of milliseconds before resolving the promise.
 * @param timeout The number of milliseconds to wait.
 */
export function sleep(timeout = 0) {
    return new Promise((resolve) => {
        setTimeout(() => resolve(), timeout);
    });
}
/**
 * Resolves after requestAnimationFrame.
 *
 * @example
 * await nextFrame();
 *
 * @returns Promise that resolved after requestAnimationFrame
 */
export function nextFrame() {
    return new Promise((resolve) => {
        if (typeof globalThis.requestAnimationFrame === 'function') {
            window.requestAnimationFrame(() => resolve);
        }
        else {
            setTimeout(() => resolve(), 0);
        }
    });
}
//# sourceMappingURL=Timers.js.map