import { Component } from "@angular/core" ; import { Application , ApplicationEventData , LaunchEventData , OrientationChangedEventData , UnhandledErrorEventData } from "@nativescript/core" ; let launchListener , suspendListener , resumeListener , exitListener , displayedListener , lowMemoryListener , orientationChangedListener , uncaughtErrorListener ; @ Component ( { moduleId : module . id , templateUrl : "./application-events.component.html" } ) export class ApplicationEventsComponent { public isItemVisible : boolean ; constructor ( ) { launchListener = ( args ) => { console . log ( "The appication was launched!" ) ; } ; Application . on ( Application . launchEvent , launchListener ) ; suspendListener = ( args ) => { console . log ( "The appication was suspended!" ) ; } ; Application . on ( Application . suspendEvent , suspendListener ) ; resumeListener = ( args ) => { console . log ( "The appication was resumed!" ) ; } ; Application . on ( Application . resumeEvent , resumeListener ) ; exitListener = ( args ) => { console . log ( "The appication was closed!" ) ; } ; Application . on ( Application . exitEvent , exitListener ) ; displayedListener = ( args ) => { console . log ( "NativeScript displayedEvent!" ) ; } ; Application . on ( Application . displayedEvent , displayedListener ) ; lowMemoryListener = ( args ) => { console . log ( "Instance: " , args . object ) ; } ; Application . on ( Application . lowMemoryEvent , lowMemoryListener ) ; orientationChangedListener = ( args ) => { console . log ( "Orientation: " , args . newValue ) ; } ; Application . on ( Application . orientationChangedEvent , orientationChangedListener ) ; uncaughtErrorListener = ( args ) => { console . log ( "NativeScript Error: " , args . error ) ; } ; Application . on ( Application . uncaughtErrorEvent , uncaughtErrorListener ) ; } }