requestNewFrame

Commons
stable

Schedule a callback to run in its own animation frame, isolated from other frame tasks. Heavy work is queued so each callback gets a fresh frame, preventing jank when multiple tasks pile up.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

cb
required
() => void
The callback to schedule. It runs alone in its own animation frame to avoid competing with other frame work.

API

Return value

The value returned by this util.

No return value. The callback is queued and executed asynchronously.

Usage

Examples

Ready-to-paste usage snippets.

Isolate a DOM measurement to its own frame

typescript