Installierbar und Settings bearbeitet
This commit is contained in:
@@ -8,30 +8,28 @@ class DelayPromise extends Promise {
|
||||
}
|
||||
}
|
||||
|
||||
class InstallManager{
|
||||
static init(){
|
||||
console.log("init");
|
||||
class InstallManager {
|
||||
static init() {
|
||||
window.addEventListener('beforeinstallprompt', e => {
|
||||
console.log("beforeinstallprompt", e);
|
||||
this.deferredPromt = e;
|
||||
if (this.canInstallListener){
|
||||
e.preventDefault();
|
||||
if (this.canInstallListener) {
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
});
|
||||
}
|
||||
static setCanInstallListener(listener, callIfCanInstall){
|
||||
|
||||
static setCanInstallListener(listener, callIfCanInstall) {
|
||||
this.canInstallListener = listener;
|
||||
callIfCanInstall = Helper.nonNull(callIfCanInstall, true);
|
||||
|
||||
if (callIfCanInstall && Helper.nonNull(this.deferredPromt)){
|
||||
if (callIfCanInstall && Helper.nonNull(this.deferredPromt)) {
|
||||
this.canInstallListener(this.deferredPromt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstallManager.init();
|
||||
window.addEventListener("load", () => {
|
||||
console.log("loaded");
|
||||
});
|
||||
|
||||
class Matomo {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user