This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature.
Explainer
Keep your UI silky smooth by running code in the spare time at the end of each animation frame. requestIdleCallback
allows you to provide a function to run in the frame gaps. Your function can query the amount of time left for the next step of your logic.