1
- "use strict" ;
2
- Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3
- const application = require ( "tns-core-modules/application" ) ;
4
- const platformModule = require ( "tns-core-modules/platform" ) ;
5
- const applicationSettingsModule = require ( "tns-core-modules/application-settings" ) ;
1
+ /*
2
+ In NativeScript, the app.js file is the entry point to your application.
3
+ You can use this file to perform app-level initialization, but the primary
4
+ purpose of the file is to pass control to the app’s first module.
5
+ */
6
+ import * as application from "tns-core-modules/application" ;
7
+ import * as platformModule from "tns-core-modules/platform" ;
8
+ import * as applicationSettingsModule from "tns-core-modules/application-settings" ;
9
+ import { Frame } from "tns-core-modules/ui/frame" ;
6
10
const deepLinkDataModule = require ( "./shared/deep-link-data" ) ;
7
11
if ( platformModule . isIOS ) {
8
12
const mydelegate = require ( "./delegate/my-delegate" ) ;
9
13
application . ios . delegate = mydelegate . MyDelegate ;
10
14
}
15
+
11
16
function launchExample ( ) {
12
- const rootView = application . getRootView ( ) ;
17
+ const rootView : Frame = < Frame > application . getRootView ( ) ;
13
18
if ( applicationSettingsModule . hasKey ( "gotoexample" ) ) {
14
19
const value = applicationSettingsModule . getString ( "gotoexample" ) ;
15
20
if ( value !== "" ) {
@@ -21,14 +26,17 @@ function launchExample() {
21
26
}
22
27
}
23
28
}
24
- application . on ( application . resumeEvent , function ( args ) {
29
+ application . on ( application . resumeEvent , ( args ) => {
25
30
if ( args . android ) {
26
31
const dld = new deepLinkDataModule . DeepLinkData ( "" , args . android ) ;
27
32
launchExample ( ) ;
28
- }
29
- else if ( args . ios ) {
33
+ } else if ( args . ios ) {
30
34
launchExample ( ) ;
31
35
}
32
36
} ) ;
33
-
34
37
application . run ( { moduleName : "app-root" } ) ;
38
+
39
+ /*
40
+ Do not place any code after the application has been started as it will not
41
+ be executed on iOS.
42
+ */
0 commit comments