Nebula icon indicating copy to clipboard operation
Nebula copied to clipboard

Start using requestIdleCallback when it is supported by Safari [🟧 awaiting safari support]

Open chrisblakley opened this issue 3 years ago • 3 comments

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

Screen Shot 2021-09-04 at 10 21 33 AM

chrisblakley avatar Sep 04 '21 14:09 chrisblakley

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

chrisblakley avatar Aug 25 '22 14:08 chrisblakley

Still no change in Safari as of July 2023...

Screen Shot 2023-07-24 at 5 13 35 PM

chrisblakley avatar Jul 24 '23 21:07 chrisblakley

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?

chrisblakley avatar Dec 12 '23 22:12 chrisblakley