Fix sw error
This commit is contained in:
+5
-5
@@ -9,12 +9,12 @@ const closePwaDialogBtn = document.querySelector('#closePwaDialog')
|
||||
// functions
|
||||
function showCustomInstallPromotion() {
|
||||
setTimeout(function() {
|
||||
customDialog.classList.add('active')
|
||||
customDialog?.classList.add('active')
|
||||
}, 500)
|
||||
}
|
||||
function hideCustomInstallPromotion() {
|
||||
setTimeout(function() {
|
||||
customDialog.classList.remove('active')
|
||||
customDialog?.classList.remove('active')
|
||||
}, 500)
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ window.addEventListener('beforeinstallprompt', e => {
|
||||
})
|
||||
|
||||
events.forEach(evt => {
|
||||
closePwaDialogBtn.addEventListener(evt, e => {
|
||||
closePwaDialogBtn?.addEventListener(evt, e => {
|
||||
hideCustomInstallPromotion()
|
||||
})
|
||||
|
||||
installBtn.addEventListener(evt, e => {
|
||||
installBtn?.addEventListener(evt, e => {
|
||||
// Hide the app provided install promotion
|
||||
hideCustomInstallPromotion()
|
||||
// Show the install prompt
|
||||
@@ -50,7 +50,7 @@ events.forEach(evt => {
|
||||
})
|
||||
|
||||
try {
|
||||
showPwaDialogBtn.addEventListener(evt, e => {
|
||||
showPwaDialogBtn?.addEventListener(evt, e => {
|
||||
if (deferredPrompt) {
|
||||
showCustomInstallPromotion()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user