import { Component } from '@angular/core' ; import { A2hsService } from './a2hs.service' ; @ Component ( { selector : 'app-root' , templateUrl : './app.component.html' , styleUrls : [ './app.component.css' ] } ) export class AppComponent { title = 'Add To Home Screen (A2HS) Tester' ; constructor ( public a2hs ) { a2hs . checkUserAgent ( ) ; a2hs . trackStandalone ( ) ; window . addEventListener ( 'beforeinstallprompt' , ( e ) => { a2hs . promptIntercepted = true ; e . preventDefault ( ) ; a2hs . deferredPrompt = e ; a2hs . promptSaved = true ; } ) ; window . addEventListener ( 'appinstalled' , ( evt ) => { a2hs . trackInstalled ( ) ; } ) ; } }