Skip to content

Commit 53ea7a9

Browse files
committed
fix: add app.ts
1 parent 369f3af commit 53ea7a9

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

app/app.js renamed to app/app.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
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";
610
const deepLinkDataModule = require("./shared/deep-link-data");
711
if (platformModule.isIOS) {
812
const mydelegate = require("./delegate/my-delegate");
913
application.ios.delegate = mydelegate.MyDelegate;
1014
}
15+
1116
function launchExample() {
12-
const rootView = application.getRootView();
17+
const rootView: Frame = <Frame> application.getRootView();
1318
if (applicationSettingsModule.hasKey("gotoexample")) {
1419
const value = applicationSettingsModule.getString("gotoexample");
1520
if (value !== "") {
@@ -21,14 +26,17 @@ function launchExample() {
2126
}
2227
}
2328
}
24-
application.on(application.resumeEvent, function (args) {
29+
application.on(application.resumeEvent, (args) => {
2530
if (args.android) {
2631
const dld = new deepLinkDataModule.DeepLinkData("", args.android);
2732
launchExample();
28-
}
29-
else if (args.ios) {
33+
} else if (args.ios) {
3034
launchExample();
3135
}
3236
});
33-
3437
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

Comments
 (0)