Files
hossein-por-shop/frontend/composables/global/usePwa.ts
T
2025-03-18 20:36:09 +03:30

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,
};
};