Skip to content

QuizNot attempted

Where does requestAnimationFrame run?

When does a requestAnimationFrame callback run?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • Right before the browser paints the next frame, after tasks and microtasks of the current turn
  • rAF callbacks run in the 'update the rendering' step, once per frame, just before style, layout and paint, after the current task and its microtasks.
  • Not a microtask: it waits for the next frame, often many milliseconds.
  • Not the macrotask queue with setTimeout: it is a separate per-frame callback list, not FIFO with timers.
  • Not a compositor thread: it is main-thread JS.
  • It is paused in background tabs.