feat: add delayed-hydration loaders for fine-grained control

This commit is contained in:
Michael Brevard 2024-06-14 16:06:54 +03:00 committed by GitHub
parent c14580d8c1
commit 23d0b8e4c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,3 +23,15 @@ export const useHydration = <K extends keyof NuxtPayload, T = NuxtPayload[K]> (k
}) })
} }
} }
/**
* A `requestIdleCallback` options utility, used for determining custom timeout for idle-callback based delayed hydration.
* @param opts the options object, containing the wanted timeout
*/
export const createIdleLoader = (opts: IdleRequestOptions) => opts
/**
* An `IntersectionObserver` options utility, used for determining custom viewport-based delayed hydration.
* @param opts the options object, containing the wanted viewport options
*/
export const createVisibleLoader = (opts: IntersectionObserverInit) => opts