You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior is only applied when we are using the `client` or `onNuxtReady`[Script Triggers](/docs/guides/scripts-triggers).
25
+
To customize the behavior further we can use the `warmupStrategy` option.
26
+
27
+
## `warmupStrategy`
28
+
29
+
The `warmupStrategy` option can be used to customize the `link` tag inserted for the script. The option can be a function
30
+
that returns an object with the following properties:
31
+
32
+
*-`false` - Disable warmup.
33
+
*-`'preload'` - Preload the script, use when the script is loaded immediately.
34
+
*-`'preconnect'` or `'dns-prefetch'` - Preconnect to the script origin, use when you know a script will be loaded within 10 seconds. Only works when loading a script from a different origin, will fallback to `false` if the origin is the same.
35
+
36
+
All of these options can also be passed to a callback function, which can be useful when have a dynamic trigger for the script.
37
+
38
+
## `warmup`
39
+
40
+
The `warmup` function can be called explicitly to add either preconnect or preload link tags for a script. This will only work the first time the function is called.
41
+
42
+
This can be useful when you know that the script is going to be loaded shortly.
43
+
44
+
```ts
45
+
const script =useScript('/video.js', {
46
+
trigger: 'manual'
47
+
})
48
+
// warmup the script when we think the user may need the script
0 commit comments