Releases: unjs/unhead
v1.9.8
🐞 Bug Fixes
- scripts:
- Avoid nulled proxy api after script load - by @harlan-zw (f4694)
- Safer and more powerful proxying - by @harlan-zw (9c73b)
View changes on GitHub
v1.9.7
🐞 Bug Fixes
- scripts: Allow properties to be returned async - by @harlan-zw (bfd7d)
View changes on GitHub
v1.9.6
🐞 Bug Fixes
- scripts:
beforeInit
hook for script deps - by @harlan-zw (8730b)- Bind to onMounted as default Vue trigger - by @harlan-zw (c34da)
- Attempt resolving api before loading - by @harlan-zw (96604)
🏎 Performance
- scripts: Drop unsupported inline HTML usage - by @harlan-zw (3bfe2)
View changes on GitHub
v1.9.5
🐞 Bug Fixes
- scripts: Privacy default attributes - by @harlan-zw (e2ba5)
- unhead: Handle
undefined
style attributes - by @sameignatovich in #337 (03d60)
View changes on GitHub
v1.9.4
🐞 Bug Fixes
- scripts: Trigger load on client-side by default - by @harlan-zw (3a93b)
View changes on GitHub
v1.9.3
🐞 Bug Fixes
- scripts:
- Avoid recursive promise objects - by @harlan-zw (c0e75)
- Silently fail broken
use
usage - by @harlan-zw (4a447) - Ensure Vue
status
gets reactive stub - by @harlan-zw (8d9b5) - More open types for function callbacks - by @harlan-zw (17218)
View changes on GitHub
v1.9.2
🐞 Bug Fixes
- useScript:
- Support
trigger: (fn: Function)
- by @harlan-zw (33fa8) - Vue status
loading
not syncing - by @harlan-zw (d0c6e) - Incorrect
onerror
triggering - by @harlan-zw (74db4)
- Support
View changes on GitHub
v1.9.1
🐞 Bug Fixes
- scripts: Avoid recursive event handling - by @harlan-zw (795d0)
🏎 Performance
- scripts: Skip
onloadstart
event - by @harlan-zw (d5a71)
View changes on GitHub
v1.9.0
Release 1.9.0 - useScript
Stable
useScript
is built to provide better performance and DX when working with Third-Party Scripts. In this release we reduce the composable size has been reduced by 30% with some notable breaking changes:
Removed trigger idle
While this was handy in user-land, providing support for it meant providing a polyfill for window.requestIdleCallback
due to limited browser support. Most integrations will already ship a polyfill for this so it added extra unnecessary weight.
If you'd like to re-implement this behaviour there's a recipe on the docs and you should provide your own polyfill (if needed).
Early connections removed
When using the composable it would try and guess how the script is being used and append a dns-prefetch
or a preconnect
<link>
depending on usage. To reduce the composable weight, this should now be implemented in user or integration land.
<link rel="dns-prefetch" href="<script-domain>" />
Awaiting Script Changes
When you wanted to avoid using the Proxy API and use the script instance directly, you could use the $script.waitForLoad()
function. To reduce the weight, the $script
object itself is now a promise:
const { $script } = useScript('<src>', { use: () => window.myScript })
$script
.then(instance => {
// script is loaded, instance is the same as window.myScript
})
.catch(() => {
// script failed to load
})
Changelog
🚨 Breaking Changes
- script:
- Remove
script:transform
hook - by @harlan-zw (1b153) $script
promisable, removewaitForLoad
- by @harlan-zw (4646d)- Remove
$script.loaded
- by @harlan-zw (7cba5) - EventContext option, skip
onabort
,onprogress
events - by @harlan-zw (335f4) - Remove early connections - by @harlan-zw (0ebac)
- Remove
🐞 Bug Fixes
- script: Typed
data-*
keys - by @harlan-zw (e8ca7)