vite-plugin-pwa
Version:
Zero-config PWA for Vite
28 lines (27 loc) • 1 kB
TypeScript
export interface RegisterSWOptions {
immediate?: boolean
/**
* Called when the service worker has taken control and the page would normally reload.
*
* Useful to fully control the reload flow (for example, to defer reload until the next
* SPA navigation).
*/
onNeedReload?: () => void
onNeedRefresh?: () => void
onOfflineReady?: () => void
/**
* Called only if `onRegisteredSW` is not provided.
*
* @deprecated Use `onRegisteredSW` instead.
* @param registration The service worker registration if available.
*/
onRegistered?: (registration: ServiceWorkerRegistration | undefined) => void
/**
* Called once the service worker is registered (requires version `0.12.8+`).
*
* @param swScriptUrl The service worker script url.
* @param registration The service worker registration if available.
*/
onRegisteredSW?: (swScriptUrl: string, registration: ServiceWorkerRegistration | undefined) => void
onRegisterError?: (error: any) => void
}