Skip to content

requestAnimationFrameAsync

Gets the next request animation frame.

Import:

import { requestAnimationFrameAsync } from 'obsidian-dev-utils/async';

Signature:

function requestAnimationFrameAsync(fallbackTimeoutInMilliseconds: number | undefined): Promise<void>

Parameters:

ParameterTypeDescription
fallbackTimeoutInMillisecondsnumber | undefinedThe fallback timeout in milliseconds to resolve the promise if requestAnimationFrame does not fire (e.g. the window is not active). Defaults to 100 milliseconds. Use 0 to disable the fallback.

Returns: Promise<void> — A promise that resolves when the next request animation frame is available (or when the fallback time is reached).