Scheduler API
ELI5 - The Vibe Check
The Scheduler API is a built in way to tell the browser this task matters a lot, do it soon, or this one can wait until you're not busy. Before this, developers faked task priority with setTimeout hacks and requestIdleCallback workarounds. Now there's an actual priority queue baked into the platform, and React's own scheduler is built on the same idea.
Real Talk
The Scheduler API, primarily scheduler.postTask(), is a browser API for scheduling tasks with explicit priorities such as user-blocking, user-visible, or background, letting the browser interleave work without freezing the main thread. It supersedes ad hoc patterns built on setTimeout(fn, 0) and requestIdleCallback for breaking up long JavaScript tasks.
Show Me The Code
await scheduler.postTask(() => {
renderNonCriticalWidget();
}, { priority: 'background' });
When You'll Hear This
"We moved our analytics batching to scheduler.postTask with background priority so it never competes with clicks." / "The Scheduler API let us drop our homemade requestIdleCallback polyfill."
Related Terms
Event Loop
JavaScript can only do one thing at a time (single-threaded), but the Event Loop is the trick that makes it seem like it can multitask.
INP (INP)
INP measures how snappy your website feels every time you interact with it — not just the first click, but every button press, dropdown open, and form subm...
Long Tasks
Long Tasks are any JavaScript tasks that take more than 50ms and block the main thread.
requestAnimationFrame
requestAnimationFrame tells the browser 'call my function right before the next screen repaint.