webapp work, push required for https
This commit is contained in:
parent
af8375e36c
commit
32e3fbad70
|
@ -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";
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue