next-pwa-pack
Version:
PWA cache provider for Next.js/React apps (service worker, manifest, offline page, SPA cache, offline)
17 lines (16 loc) • 590 B
TypeScript
export type PWAStatus = {
online: boolean;
hasUpdate: boolean;
swInstalled: boolean;
update: () => void;
};
/**
* usePWAStatus — hook for tracking the status of PWA/Service Worker.
* Returns the online/offline status, the presence of an update, whether the SW is installed, and a function to update.
*
* @example
* const { online, hasUpdate, swInstalled, update } = usePWAStatus();
* if (!online) return <div>You are offline</div>;
* if (hasUpdate) return <button onClick={update}>Update application</button>;
*/
export declare function usePWAStatus(): PWAStatus;