Nebula
Nebula copied to clipboard
Start using requestIdleCallback when it is supported by Safari [🟧 awaiting safari support]
I've been monitoring this one for a while (and using it on some personal projects already), but requestIdleCallback()
which is used similarly to requestAnimationFrame()
is supported by all browsers except Safari (desktop and mobile).
Once it is supported, I'd like to sprinkle it in key locations throughout Nebula JavaScript. Noting it here so I don't forget (and if I have any additional notes in the future).
https://caniuse.com/requestidlecallback
Be sure to use this with the timeout
parameter in the options object:
requestIdleCallback(function(){
//Do stuff
}, {timeout: 1000}); //Timeout is in ms and will run regardless of CPU idle after that period of time
https://developer.mozilla.org/en-US/docs/Web/API/window/requestIdleCallback
Still no change in Safari as of July 2023...
Safari Technology Preview now supports requestIdleCallback
so maybe potentially in Safari 18? Maybe optimistically earlier, but I think historically it happens at the major version that is released with the next OS version... so... October 2024?