mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -04:00
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
/// <reference types="vite/client" />
|
|
/// <reference types="vite-svg-loader" />
|
|
/// <reference types="vite-plugin-pwa/client" />
|
|
|
|
declare module 'virtual:pwa-register/vue' {
|
|
// @ts-expect-error ignore when vue is not installed
|
|
import type { Ref } from 'vue';
|
|
|
|
export interface RegisterSWOptions {
|
|
immediate?: boolean;
|
|
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;
|
|
}
|
|
|
|
export function useRegisterSW(options?: RegisterSWOptions): {
|
|
needRefresh: Ref<boolean>;
|
|
offlineReady: Ref<boolean>;
|
|
updateServiceWorker: (reloadPage?: boolean) => Promise<void>;
|
|
};
|
|
}
|
|
|
|
interface ImportMetaEnv {
|
|
VITE_PLAUSIBLE_API_HOST: string;
|
|
VITE_PLAUSIBLE_DOMAIN: string;
|
|
PACKAGE_VERSION: string;
|
|
GIT_SHORT_SHA: string;
|
|
PROD: boolean;
|
|
}
|
|
|
|
interface ImportMeta {
|
|
readonly env: ImportMetaEnv;
|
|
}
|