Fix PWA install button
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
export default (() => {
|
export default () => {
|
||||||
//*** Determine whether or not the PWA has been installed. ***//
|
//*** Determine whether or not the PWA has been installed. ***//
|
||||||
|
|
||||||
// Step 1: Check local storage
|
// Step 1: Check local storage
|
||||||
@@ -23,7 +23,7 @@ export default (() => {
|
|||||||
|
|
||||||
// Show the install button if the prompt appeared.
|
// Show the install button if the prompt appeared.
|
||||||
if (!pwaInstalled) {
|
if (!pwaInstalled) {
|
||||||
document.getElementById('installPWA').style.display = 'block';
|
document.querySelector('#installPWA').style.display = 'block';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -34,6 +34,9 @@ export default (() => {
|
|||||||
document.getElementById('installPWA').style.display = 'none';
|
document.getElementById('installPWA').style.display = 'none';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// When the app is uninstalled, add the prompts back
|
||||||
|
|
||||||
|
|
||||||
return async () => {
|
return async () => {
|
||||||
if (deferredPrompt) {
|
if (deferredPrompt) {
|
||||||
deferredPrompt.prompt();
|
deferredPrompt.prompt();
|
||||||
@@ -48,4 +51,4 @@ export default (() => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
};
|
||||||
|
|||||||
@@ -54,7 +54,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted () {
|
mounted () {
|
||||||
this.showInstallPrompt = intializePwa();
|
(async () => {
|
||||||
|
this.showInstallPrompt = await intializePwa();
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user