@@ -13,7 +13,7 @@ import "nativescript-intl";
13
13
import { TextView } from "@nativescript/core/ui/text-view" ;
14
14
import { Color , View } from "@nativescript/core/ui/core/view" ;
15
15
import { 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" ;
17
17
18
18
import {
19
19
Type ,
@@ -76,8 +76,8 @@ export interface HmrOptions {
76
76
// tslint:enable:max-line-length
77
77
78
78
export interface AppLaunchView extends View {
79
- startAnimation ?: ( ) => void ;
80
- cleanup ?: ( ) => void ;
79
+ startAnimation ?: ( ) => void ;
80
+ cleanup ?: ( ) => void ;
81
81
}
82
82
83
83
export interface AppOptions {
@@ -209,50 +209,52 @@ export class NativeScriptPlatformRef extends PlatformRef {
209
209
}
210
210
211
211
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
+ }
219
219
} 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 ) ;
223
225
}
224
226
args . root = launchView ;
225
227
setRootPage ( < any > launchView ) ;
226
228
227
229
// Launch Angular app
228
230
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
+ ) ;
256
258
}
257
259
) ;
258
260
const exitCallback = profile (
@@ -293,32 +295,32 @@ export class NativeScriptPlatformRef extends PlatformRef {
293
295
}
294
296
295
297
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
+ ) ;
322
324
}
323
325
324
326
private createErrorUI ( message : string ) : View {
0 commit comments