requestIdleCallback
A function that schedules low-priority work to run when the browser has spare time at the end of a frame.
In more detail
The callback gets an IdleDeadline to check how much time is left, and a timeout option guarantees it runs eventually if the browser stays busy. It suits analytics, prefetching and background indexing, not visible updates.
Related terms
- IdleDeadline — The object passed to a requestIdleCallback callback, whose timeRemaining() method says how many milliseconds of idle time are left.
- requestAnimationFrame() — A function that schedules a callback to run just before the browser's next repaint, the right place to update animations.
- cooperative multitasking — A scheduling style where each piece of work voluntarily gives up control after a short time so others can run, instead of being interrupted.
- telemetry — The data a running system sends out about itself, such as logs, metrics and traces.
- preloading — Starting to download code or data before it is needed, so it is ready by the time the user asks for it.
- main thread — The first thread a program starts with; in a browser page it also runs JavaScript and handles input, layout and painting.
Taught in
- The Browser Event Loop: Call Stack, Microtasks And Macrotasks — Frontend Architecture & Web Platform
- requestAnimationFrame vs requestIdleCallback: High-FPS Work — Frontend Architecture & Web Platform
- Code-Splitting with React.lazy: Dynamic Imports And Chunks — React 19 & Modern Component Architecture