Debounces a callback using requestAnimationFrame to sync with display refresh rate.
This is ideal for high-frequency events like scroll, resize, or mousemove that need
to update the UI. Instead of running on every event (which can be 1000+ times/sec),
the callback runs at the display refresh rate (60fps/120fps).
Debounces a callback using requestAnimationFrame to sync with display refresh rate.
This is ideal for high-frequency events like scroll, resize, or mousemove that need to update the UI. Instead of running on every event (which can be 1000+ times/sec), the callback runs at the display refresh rate (60fps/120fps).