MCPcopy
hub / github.com/vercel/next.js / handleClientScriptLoad

Function handleClientScriptLoad

packages/next/src/client/script.tsx:158–167  ·  view source on GitHub ↗
(props: ScriptProps)

Source from the content-addressed store, hash-verified

156}
157
158export 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
169function loadLazyScript(props: ScriptProps) {
170 if (document.readyState === 'complete') {

Callers 1

changeMethod · 0.90

Calls 2

loadScriptFunction · 0.85
addEventListenerMethod · 0.80

Tested by

no test coverage detected