@@ -13,7 +13,7 @@ import "nativescript-intl";
1313import { TextView } from "@nativescript/core/ui/text-view" ;
1414import { Color , View } from "@nativescript/core/ui/core/view" ;
1515import { Frame } from "@nativescript/core/ui/frame" ;
16- import { GridLayout } from ' @nativescript/core/ui/layouts/grid-layout' ;
16+ import { GridLayout } from " @nativescript/core/ui/layouts/grid-layout" ;
1717
1818import {
1919 Type ,
@@ -76,8 +76,8 @@ export interface HmrOptions {
7676// tslint:enable:max-line-length
7777
7878export interface AppLaunchView extends View {
79- startAnimation ?: ( ) => void ;
80- cleanup ?: ( ) => void ;
79+ startAnimation ?: ( ) => void ;
80+ cleanup ?: ( ) => void ;
8181}
8282
8383export interface AppOptions {
@@ -209,50 +209,52 @@ export class NativeScriptPlatformRef extends PlatformRef {
209209 }
210210
211211 if ( this . appOptions && this . appOptions . launchView ) {
212- launchView = this . appOptions . launchView ;
213- if ( this . appOptions . launchView . startAnimation ) {
214- setTimeout ( ( ) => {
215- // ensure launch animation is executed after launchView added to view stack
216- this . appOptions . launchView . startAnimation ( ) ;
217- } ) ;
218- }
212+ launchView = this . appOptions . launchView ;
213+ if ( this . appOptions . launchView . startAnimation ) {
214+ setTimeout ( ( ) => {
215+ // ensure launch animation is executed after launchView added to view stack
216+ this . appOptions . launchView . startAnimation ( ) ;
217+ } ) ;
218+ }
219219 } else {
220- launchView = new GridLayout ( ) ;
221- // Custom launch view color (useful when doing async app intializers where you don't want a flash of undesirable color)
222- launchView . backgroundColor = new Color ( this . appOptions && this . appOptions . backgroundColor ? this . appOptions . backgroundColor : '#fff' ) ;
220+ launchView = new GridLayout ( ) ;
221+ // Custom launch view color (useful when doing async app intializers
222+ // where you don't want a flash of undesirable color).
223+ const bgCol = this . appOptions && this . appOptions . backgroundColor ? this . appOptions . backgroundColor : "#fff" ;
224+ launchView . backgroundColor = new Color ( bgCol ) ;
223225 }
224226 args . root = launchView ;
225227 setRootPage ( < any > launchView ) ;
226228
227229 // Launch Angular app
228230 this . _bootstrapper ( ) . then (
229- moduleRef => {
230-
231- if ( isLogEnabled ( ) ) {
232- bootstrapLog ( `Angular bootstrap bootstrap done. uptime: ${ uptime ( ) } ` ) ;
233- }
234-
235- rootContent = launchView ;
236- if ( launchView && launchView . cleanup ) {
237- // cleanup any custom launch views
238- launchView . cleanup ( ) ;
239- }
240-
241- lastBootstrappedModule = new WeakRef ( moduleRef ) ;
242- } ,
243- err => {
244-
245- const errorMessage = err . message + "\n\n" + err . stack ;
246- if ( isLogEnabled ( ) ) {
247- bootstrapLogError ( "ERROR BOOTSTRAPPING ANGULAR" ) ;
248- }
249- if ( isLogEnabled ( ) ) {
250- bootstrapLogError ( errorMessage ) ;
251- }
252-
253- rootContent = this . createErrorUI ( errorMessage ) ;
254- }
255- ) ;
231+ moduleRef => {
232+
233+ if ( isLogEnabled ( ) ) {
234+ bootstrapLog ( `Angular bootstrap bootstrap done. uptime: ${ uptime ( ) } ` ) ;
235+ }
236+
237+ rootContent = launchView ;
238+ if ( launchView && launchView . cleanup ) {
239+ // cleanup any custom launch views
240+ launchView . cleanup ( ) ;
241+ }
242+
243+ lastBootstrappedModule = new WeakRef ( moduleRef ) ;
244+ } ,
245+ err => {
246+
247+ const errorMessage = err . message + "\n\n" + err . stack ;
248+ if ( isLogEnabled ( ) ) {
249+ bootstrapLogError ( "ERROR BOOTSTRAPPING ANGULAR" ) ;
250+ }
251+ if ( isLogEnabled ( ) ) {
252+ bootstrapLogError ( errorMessage ) ;
253+ }
254+
255+ rootContent = this . createErrorUI ( errorMessage ) ;
256+ }
257+ ) ;
256258 }
257259 ) ;
258260 const exitCallback = profile (
@@ -293,32 +295,32 @@ export class NativeScriptPlatformRef extends PlatformRef {
293295 }
294296
295297 this . _bootstrapper ( ) . then (
296- moduleRef => {
297- if ( isLogEnabled ( ) ) {
298- bootstrapLog ( "Angular livesync done." ) ;
299- }
300- onAfterLivesync . next ( { moduleRef } ) ;
301-
302- lastBootstrappedModule = new WeakRef ( moduleRef ) ;
303- applicationRerun ( {
304- create : ( ) => getRootPage ( ) ,
305- } ) ;
306- } ,
307- error => {
308- if ( isLogEnabled ( ) ) {
309- bootstrapLogError ( "ERROR LIVESYNC BOOTSTRAPPING ANGULAR" ) ;
310- }
311- const errorMessage = error . message + "\n\n" + error . stack ;
312- if ( isLogEnabled ( ) ) {
313- bootstrapLogError ( errorMessage ) ;
314- }
315-
316- applicationRerun ( {
317- create : ( ) => this . createErrorUI ( errorMessage ) ,
318- } ) ;
319- onAfterLivesync . next ( { error } ) ;
320- }
321- ) ;
298+ moduleRef => {
299+ if ( isLogEnabled ( ) ) {
300+ bootstrapLog ( "Angular livesync done." ) ;
301+ }
302+ onAfterLivesync . next ( { moduleRef } ) ;
303+
304+ lastBootstrappedModule = new WeakRef ( moduleRef ) ;
305+ applicationRerun ( {
306+ create : ( ) => getRootPage ( ) ,
307+ } ) ;
308+ } ,
309+ error => {
310+ if ( isLogEnabled ( ) ) {
311+ bootstrapLogError ( "ERROR LIVESYNC BOOTSTRAPPING ANGULAR" ) ;
312+ }
313+ const errorMessage = error . message + "\n\n" + error . stack ;
314+ if ( isLogEnabled ( ) ) {
315+ bootstrapLogError ( errorMessage ) ;
316+ }
317+
318+ applicationRerun ( {
319+ create : ( ) => this . createErrorUI ( errorMessage ) ,
320+ } ) ;
321+ onAfterLivesync . next ( { error } ) ;
322+ }
323+ ) ;
322324 }
323325
324326 private createErrorUI ( message : string ) : View {
0 commit comments