"use client"; /** * Next.js asset preloading hooks for the asset caching module */ import { useEffect } from "react"; import { AssetLoader, CacheOptions } from "@shopkit/asset-cache"; /** * Hook to preload assets on page load * @param urls URLs of assets to preload * @param options Caching options */ export function useAssetCachePreload( urls: string[], options?: CacheOptions ): void { useEffect(() => { // Preload assets in the background urls.forEach((url) => { AssetLoader.preload(url, options).catch(() => { // Ignore preloading errors }); }); }, [urls, options]); }