IT lexicon › Web › requestIdleCallback

requestIdleCallback

Web På svenska → Updated: 2026-05-30

A web API for scheduling low-priority work so it runs when the browser is idle anyway (in the gaps between frames), without disturbing more important tasks like rendering and input. For "can-wait" jobs.

Idea: some tasks aren't urgent — sending analytics, preprocessing data, warming a cache, lazy-initializing something. If you run them right away they can steal time from rendering and make the page choppy or slow to respond to clicks. requestIdleCallback(callback) queues the work and the browser runs it in the idle moments between other tasks, and gives your callback a "deadline" (how much idle time is left) so you can split the work up. Use case: non-critical background work, telemetry, speculative preloading, batched processing. The opposite of requestAnimationFrame (which is for what MUST happen every frame). Limitation: Safari support has been uneven, and you should always have a timeout fallback. Part of modern work scheduling in the browser, related to React's time-slicing. Related to requestAnimationFrame and web workers.

← Back to the lexicon