refactor: inject pwa client plugin from module (#1758)
This commit is contained in:
parent
523578ba7b
commit
436489461c
7 changed files with 28 additions and 7 deletions
|
@ -4,7 +4,7 @@ export function useWebShareTarget(listener?: (message: MessageEvent) => void) {
|
|||
|
||||
onBeforeMount(() => {
|
||||
// PWA must be installed to use share target
|
||||
if (useNuxtApp().$pwa.isInstalled && 'serviceWorker' in navigator) {
|
||||
if (useNuxtApp().$pwa?.isInstalled && 'serviceWorker' in navigator) {
|
||||
if (listener)
|
||||
navigator.serviceWorker.addEventListener('message', listener)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue