(props: ScriptProps)
| 156 | } |
| 157 | |
| 158 | export function handleClientScriptLoad(props: ScriptProps) { |
| 159 | const { strategy = 'afterInteractive' } = props |
| 160 | if (strategy === 'lazyOnload') { |
| 161 | window.addEventListener('load', () => { |
| 162 | requestIdleCallback(() => loadScript(props)) |
| 163 | }) |
| 164 | } else { |
| 165 | loadScript(props) |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | function loadLazyScript(props: ScriptProps) { |
| 170 | if (document.readyState === 'complete') { |
no test coverage detected