20 lines
463 B
TypeScript
20 lines
463 B
TypeScript
export const usePWA = () => {
|
|
const isInstalledAsPWA = ref(false);
|
|
|
|
const checkPWAInstallation = () => {
|
|
const isStandalone = window.matchMedia(
|
|
"(display-mode: standalone)"
|
|
).matches;
|
|
const isIOSPWA = (window.navigator as any).standalone;
|
|
isInstalledAsPWA.value = isStandalone || isIOSPWA;
|
|
};
|
|
|
|
onMounted(() => {
|
|
checkPWAInstallation();
|
|
});
|
|
|
|
return {
|
|
isInstalledAsPWA,
|
|
};
|
|
};
|