swup / preload-plugin

A swup plugin for preloading pages to speed up navigation 🚀
https://swup.js.org/plugins/preload-plugin
MIT License
14 stars 14 forks source link

requestIdleCallback not available in Safari #98

Closed jorisnoo closed 1 year ago

jorisnoo commented 1 year ago

Although the plugin seems to work just fine, the following error is being thrown in Safari: Unhandled Promise Rejection: ReferenceError: Can't find variable: requestIdleCallback, as the browser does not support requestIdleCallback.

See a related issue: https://github.com/remix-run/indie-stack/issues/124 where a possible fallback is being suggested.

Thanks for all your effort on this, much appreciated!

daun commented 1 year ago

Wow, I just checked the caniuse page for requestIdleCallback and Safari has had support for this for more than three years now but it's still behind a feature flag 😩 Falling back to setTimeout should work here as well. Thanks for reporting!

daun commented 1 year ago

Fixed and released as 3.2.3, thanks again for reporting.