import '@stencil/router' ; import '@ionic/core' ; import { Component , Prop , Listen } from '@stencil/core' ; import { ToastController } from '@ionic/core' ; @ Component ( { tag : 'my-app' , styleUrl : 'my-app.scss' } ) export class MyApp { @ Prop ( { connect : 'ion-toast-controller' } ) toastCtrl : ToastController ; componentDidLoad ( ) { window . addEventListener ( 'swUpdate' , ( ) => { this . toastCtrl . create ( { message : 'New version available' , showCloseButton : true , closeButtonText : 'Reload' } ) . then ( ( toast ) => { toast . present ( ) ; } ) ; } ) ; } @ Listen ( 'body:ionToastWillDismiss' ) reload ( ) { window . location . reload ( ) ; } render ( ) { return ( < ion - app > < main > < stencil - router > < stencil - route url = '/' component = 'app-home' > < /stencil-route> < stencil - route url = '/detail/:id' component = 'track-detail' > < /stencil-route> < stencil - route url = '/favorites' component = 'fave-page' > < /stencil-route> < /stencil-router> < /main> < /ion-app>); } }