unjs / unhead

Unhead is the any-framework document head manager built for performance and delightful developer experience.

Home Page:https://unhead.unjs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useScript 'idle' requestIdleCallback Safari

wadeV12 opened this issue · comments

Environment

image

Reproduction

const { $script } = useScript({
      src: 'https://path.to/script.js',
      async: true
    }, { trigger: 'idle' })

Describe the bug

Unfortunately requestIdleCallback https://caniuse.com/requestidlecallback is not supported by Safari so far and we need to use setTimeout as a fallback.

https://github.com/unjs/unhead/blob/main/packages/unhead/src/composables/useScript.ts#L123

image

Additional context

No response

Logs

No response