[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2024-06-14 16:24:13 +00:00 committed by GitHub
parent dbdb3fe6a1
commit d520d347f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,5 @@
import { useNuxtApp } from './nuxt' import { useNuxtApp } from './nuxt'
export function toArray<T> (value: T | T[]): T[] { export function toArray<T> (value: T | T[]): T[] {
return Array.isArray(value) ? value : [value] return Array.isArray(value) ? value : [value]
} }
@ -9,7 +8,7 @@ export type CallbackFn = () => void
export type ObserveFn = (element: Element, callback: CallbackFn) => () => void export type ObserveFn = (element: Element, callback: CallbackFn) => () => void
export function useIntersectionObserver (options?: IntersectionObserverInit): { observe: ObserveFn } { export function useIntersectionObserver (options?: IntersectionObserverInit): { observe: ObserveFn } {
if (import.meta.server) { return {observe: () => () => {}} } if (import.meta.server) { return { observe: () => () => {} } }
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
if (nuxtApp._observer) { if (nuxtApp._observer) {
@ -28,7 +27,7 @@ export function useIntersectionObserver (options?: IntersectionObserverInit): {
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0 const isVisible = entry.isIntersecting || entry.intersectionRatio > 0
if (isVisible && callback) { callback() } if (isVisible && callback) { callback() }
} }
},options) }, options)
} }
callbacks.set(element, callback) callbacks.set(element, callback)
observer.observe(element) observer.observe(element)