Which data type is recommended to use with the beforeinstallprompt
event?
I attempted to utilize the BeforeInstallPromptEvent
type, but it resulted in an error:
export class PwaService {
//promptEvent: BeforeInstallPromptEvent;
promptEvent;
constructor(private swUpdate: SwUpdate, platform: PlatformService) {
if(platform.isBrowser()){
swUpdate.available.subscribe(event => {
/*if (askUserToUpdate()) {
window.location.reload();
}*/
});
window.addEventListener('beforeinstallprompt', event => {
this.promptEvent = event;
});
}
}
install(): void {
if(this.promptEvent){
this.promptEvent.prompt();
}
}
}