webapp work, push required for https

This commit is contained in:
Neale Pickett 2018-11-21 22:12:25 +00:00
parent af8375e36c
commit 32e3fbad70
1 changed files with 5 additions and 2 deletions

View File

@ -55,19 +55,22 @@ function init() {
} }
// Let people add this app // Let people add this app
let deferredPrompt;
let installButton = document.querySelector("#install"); let installButton = document.querySelector("#install");
installButton.style.display = "none"; installButton.style.display = "none";
window.addEventListener("beforeinstallprompt", e => { window.addEventListener("beforeinstallprompt", e => {
console.log(e);
deferredPrompt = e; deferredPrompt = e;
installButton.style.display = "block"; installButton.style.display = "block";
}); });
installButton.addEventListener("click", e => { installButton.addEventListener("click", e => {
console.log(e);
deferredPrompt.prompt(); deferredPrompt.prompt();
deferredPrompt.userChoice deferredPrompt.userChoice
.then(result => { .then(result => {
if (result.output == "accepted") { if (result.output == "accepted") {
installButton.style.display = "none" installButton.style.display = "none";
}; }
}); });
}); });
} }