mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
parent
0ead860117
commit
c2e22c60e9
@ -14,7 +14,7 @@ import { onNuxtReady } from '../composables/ready'
|
||||
import { navigateTo, useRouter } from '../composables/router'
|
||||
import { useNuxtApp, useRuntimeConfig } from '../nuxt'
|
||||
import { cancelIdleCallback, requestIdleCallback } from '../compat/idle-callback'
|
||||
import type { ObserveFn, CallbackFn } from '../utils'
|
||||
import type { CallbackFn, ObserveFn } from '../utils'
|
||||
|
||||
// @ts-expect-error virtual file
|
||||
import { nuxtLinkDefaults } from '#build/nuxt.config.mjs'
|
||||
@ -480,7 +480,7 @@ function useObserver (): { observe: ObserveFn } | undefined {
|
||||
}
|
||||
|
||||
const _observer = nuxtApp._observer = {
|
||||
observe
|
||||
observe,
|
||||
}
|
||||
|
||||
return _observer
|
||||
|
@ -4,11 +4,11 @@ import type { Component, Ref } from 'vue'
|
||||
import type { ObserveFn } from '#app/utils'
|
||||
import { getFragmentHTML } from '#app/components/utils'
|
||||
import { useNuxtApp } from '#app/nuxt'
|
||||
import { requestIdleCallback, cancelIdleCallback } from '#app/compat/idle-callback'
|
||||
import { cancelIdleCallback, requestIdleCallback } from '#app/compat/idle-callback'
|
||||
import { onNuxtReady } from '#app'
|
||||
|
||||
function useIntersectionObserver(options: IntersectionObserverInit) : {observe: ObserveFn} {
|
||||
if (import.meta.server) { return {observe: () => () => {}}}
|
||||
function useIntersectionObserver (options: IntersectionObserverInit): { observe: ObserveFn } {
|
||||
if (import.meta.server) { return { observe: () => () => {} } }
|
||||
|
||||
let observer: IntersectionObserver | null = null
|
||||
|
||||
@ -30,7 +30,7 @@ function useIntersectionObserver(options: IntersectionObserverInit) : {observe:
|
||||
}
|
||||
|
||||
const _observer = {
|
||||
observe
|
||||
observe,
|
||||
}
|
||||
|
||||
return _observer
|
||||
@ -100,12 +100,12 @@ export const createLazyNetworkClientPage = (componentLoader: Component) => {
|
||||
const isIdle = ref(false)
|
||||
let idleHandle: number | null = null
|
||||
onMounted(() => {
|
||||
onNuxtReady(()=>{
|
||||
onNuxtReady(() => {
|
||||
idleHandle = requestIdleCallback(() => {
|
||||
isIdle.value = true
|
||||
cancelIdleCallback(idleHandle as unknown as number)
|
||||
idleHandle = null
|
||||
}, attrs.loader ?? {timeout: 10000})
|
||||
}, attrs.loader ?? { timeout: 10000 })
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user