window.requestIdleCallback API is an experimental alternative to setTimeout for running a callback when only when the browser is not busy. This permits to give a lower priority to a task.
Documentation: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback