scheduler.yield()

A browser API that pauses a long-running async function so the browser can handle input and rendering, then resumes it with high priority.

In more detail

await scheduler.yield() inside a loop breaks it into short tasks without losing its place in line to other queued work. Check support first; setTimeout is the common fallback.

Related terms

Taught in

References