Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
Biune committed Nov 30, 2022
1 parent e1b5aee commit 291f273
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion static/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,18 @@ function changeFavicon(src) {
document.head.removeChild(oldLink);
}
document.head.appendChild(link);
}
}

// This variable will save the event for later use.
let deferredPrompt;
window.addEventListener('beforeinstallprompt', (e) => {
// Prevents the default mini-infobar or install dialog from appearing on mobile
e.preventDefault();
// Save the event because you'll need to trigger it later.
deferredPrompt = e;
// Show your customized install prompt for your PWA
// Your own UI doesn't have to be a single element, you
// can have buttons in different locations, or wait to prompt
// as part of a critical journey.
showInAppInstallPromotion();
});

0 comments on commit 291f273

Please sign in to comment.