|
|
@ -34,22 +34,20 @@ const preconnect = () => {
|
|
|
|
|
|
|
|
|
|
|
|
const rIC = window.requestIdleCallback || setTimeout
|
|
|
|
const rIC = window.requestIdleCallback || setTimeout
|
|
|
|
rIC(() => {
|
|
|
|
rIC(() => {
|
|
|
|
if (!theme.value.algolia || document.head.querySelector(`#${id}`)) return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const preconnect = document.createElement('link')
|
|
|
|
const preconnect = document.createElement('link')
|
|
|
|
preconnect.id = id
|
|
|
|
preconnect.id = id
|
|
|
|
preconnect.rel = 'preconnect'
|
|
|
|
preconnect.rel = 'preconnect'
|
|
|
|
preconnect.href = `https://${theme.value.algolia.appId}-dsn.algolia.net`
|
|
|
|
preconnect.href = `https://${theme.value.algolia!.appId}-dsn.algolia.net`
|
|
|
|
preconnect.crossOrigin = ''
|
|
|
|
preconnect.crossOrigin = ''
|
|
|
|
document.head.appendChild(preconnect)
|
|
|
|
document.head.appendChild(preconnect)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
if (!theme.value.algolia) {
|
|
|
|
if (!theme.value.algolia) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
preconnect()
|
|
|
|
preconnect()
|
|
|
|
|
|
|
|
|
|
|
|
// meta key detect (same logic as in @docsearch/js)
|
|
|
|
// meta key detect (same logic as in @docsearch/js)
|
|
|
|