20 lines
745 B
TypeScript
20 lines
745 B
TypeScript
declare module 'virtual:pwa-register/react' {
|
|
// eslint-disable-next-line ts/ban-ts-comment
|
|
// @ts-ignore ignore when react is not installed
|
|
import type { Dispatch, SetStateAction } from 'react'
|
|
import type { RegisterSWOptions } from 'vite-plugin-pwa/types'
|
|
|
|
export type { RegisterSWOptions }
|
|
|
|
export function useRegisterSW(options?: RegisterSWOptions): {
|
|
needRefresh: [boolean, Dispatch<SetStateAction<boolean>>]
|
|
offlineReady: [boolean, Dispatch<SetStateAction<boolean>>]
|
|
/**
|
|
* Reloads the current window to allow the service worker take the control.
|
|
*
|
|
* @param reloadPage From version 0.13.2+ this param is not used anymore.
|
|
*/
|
|
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
|
|
}
|
|
}
|