Files
aigen/plugins/pwa.client.ts
T

17 lines
547 B
TypeScript

export default defineNuxtPlugin(() => {
const config = useRuntimeConfig()
const name = String(config.public.instanceName || 'AIGen')
useHead({
meta: [
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'apple-mobile-web-app-title', content: name },
{ name: 'mobile-web-app-capable', content: 'yes' }
],
link: [
{ rel: 'manifest', href: '/manifest.webmanifest' }
]
})
if (!('serviceWorker' in navigator)) return
void navigator.serviceWorker.register('/sw.js').catch(() => null)
})