next-pwa-pack
Version:
PWA cache provider for Next.js/React apps (service worker, manifest, offline page, SPA cache, offline)
67 lines (66 loc) • 1.94 kB
TypeScript
/**
* Clears all caches related to the service worker.
*
* @example
* ```ts
* import { clearAllCache } from "next-pwa-pack";
* await clearAllCache();
* ```
*/
export declare function clearAllCache(): Promise<void>;
/**
* Reload service worker
*
* @example
* ```ts
* import { reloadServiceWorker } from "next-pwa-pack";
* await reloadServiceWorker();
* ```
*/
export declare function reloadServiceWorker(): Promise<void>;
/**
* Updates the cache for the page.
*
* @param url - url page to update cache (default is current page)
* @example
* ```ts
* import { updatePageCache } from "next-pwa-pack";
* await updatePageCache("/page");
* ```
*/
export declare function updatePageCache(url?: string): void;
/**
* Unregisters the service worker and clears the cache.
*
* @example
* ```ts
* import { unregisterServiceWorkerAndClearCache } from "next-pwa-pack";
* await unregisterServiceWorkerAndClearCache();
* ```
*/
export declare function unregisterServiceWorkerAndClearCache(): Promise<void>;
/**
* Signals the client to update the cache for multiple urls in other tabs.
* Can be called after revalidateTag on the client.
* @param urls - array of urls to update cache
*/
export declare function signalSWRevalidate(urls: string[]): void;
/**
* Trigger signal for all tabs and update cache in current tab.
* Can be called after revalidateTag on the client.
* @param urls - array of urls to update cache
*/
export declare function updateSWCache(urls: string[]): void;
/**
* Disables all PWA cache globally (until reload or enablePWACache is called).
*/
export declare function disablePWACache(): void;
/**
* Enables all PWA cache globally (after disablePWACache).
*/
export declare function enablePWACache(): void;
/**
* Clears static assets cache (API data, JSON responses, etc.)
* Useful for clearing cached API responses after revalidation.
*/
export declare function clearStaticCache(): void;