Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit c19ab28

Browse files
committed
Merge pull request #15 from NativeScript/fix
Fixed the ordering.
2 parents bbcba42 + d601df6 commit c19ab28

File tree

9 files changed

+57
-39
lines changed

9 files changed

+57
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Use the [NativeScript CLI](http://www.telerik.com/forums/using-the-cli-to-build-
1616
Read the advanced topics below or refer to the [Api Reference](ApiReference/) to build a powerful NativeScript application:
1717

1818
- [Application](application-management.md)
19-
- [Layouts](layouts.md)
2019
- [Navigation](navigation.md)
20+
- [Layouts](layouts.md)
2121
- [Styling](styling.md)
2222
- [Binding](bindings.md)
2323
- [UI with XML](ui-with-xml.md)

application-management.md

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,19 @@ nav-title: "Application Management"
33
title: "Application Management"
44
description: "Application Management"
55
position: 2
6-
---
76

8-
# Persist and Restore Application Settings
9-
To persist settings that the user has defined you have to use the local-settings module. The local-settings module is a static singleton hash table that stores key-value pairs for the application. The getter methods have two parameters -- a key and an optional default value to return if the specified key does not exist. The setter methods also have two parameters -- key and value. Here is an example of using the local settings-module and all of its available methods:
7+
---
8+
# Application Start
9+
You are required to call the **start** method of the application module once you are ready with its initialization. This method doesn't do anything for an Android application at the moment but may do in the future. In an iOS application this call will start the UIApplication and will trigger its UI message loop.:
1010
``` JavaScript
11-
var localSettings = require("local-settings");
12-
// Event handler for Page "loaded" event attached in main-page.xml
13-
function pageLoaded(args) {
14-
localSettings.setString("Name", "John Doe");
15-
console.log(localSettings.getString("Name")); // Prints "John Doe"
16-
localSettings.setBoolean("Married", false);
17-
console.log(localSettings.getBoolean("Married")); // Prints false
18-
localSettings.setNumber("Age", 42);
19-
console.log(localSettings.getNumber("Age")); // Prints 42
20-
console.log(localSettings.hasKey("Name")); // Prints true
21-
localSettings.remove("Name"); // Removes the Name entry.
22-
console.log(localSettings.hasKey("Name")); // Prints false
23-
}
24-
exports.pageLoaded = pageLoaded;
11+
var application = require("application");
12+
application.mainModule = "app/template-settings/main-page";
13+
application.start();
2514
```
2615
``` TypeScript
27-
import observable = require("data/observable");
28-
import localSettings = require("local-settings");
29-
// Event handler for Page "loaded" event attached in main-page.xml
30-
export function pageLoaded(args: observable.EventData) {
31-
localSettings.setString("Name", "John Doe");
32-
console.log(localSettings.getString("Name"));// Prints "John Doe"
33-
localSettings.setBoolean("Married", false);
34-
console.log(localSettings.getBoolean("Married"));// Prints false
35-
localSettings.setNumber("Age", 42);
36-
console.log(localSettings.getNumber("Age"));// Prints 42
37-
console.log(localSettings.hasKey("Name"));// Prints true
38-
localSettings.remove("Name");// Removes the Name entry.
39-
console.log(localSettings.hasKey("Name"));// Prints false
40-
}
16+
import application = require("application");
17+
application.mainModule = "app/main-page";
18+
application.start();
4119
```
4220
# Using Application Callbacks
4321
Each NativeScript application has several important lifecycle events. You can use those events to perform all kinds of needed maintanance and housekeeping:
@@ -107,4 +85,38 @@ application.onUncaughtError = function (error: application.NativeScriptError) {
10785
console.log("Application error: " + error.name + "; " + error.message + "; " + error.nativeError);
10886
}
10987
application.start();
88+
```
89+
# Persist and Restore Application Settings
90+
To persist settings that the user has defined you have to use the local-settings module. The local-settings module is a static singleton hash table that stores key-value pairs for the application. The getter methods have two parameters -- a key and an optional default value to return if the specified key does not exist. The setter methods also have two parameters -- key and value. Here is an example of using the local settings-module and all of its available methods:
91+
``` JavaScript
92+
var localSettings = require("local-settings");
93+
// Event handler for Page "loaded" event attached in main-page.xml
94+
function pageLoaded(args) {
95+
localSettings.setString("Name", "John Doe");
96+
console.log(localSettings.getString("Name")); // Prints "John Doe"
97+
localSettings.setBoolean("Married", false);
98+
console.log(localSettings.getBoolean("Married")); // Prints false
99+
localSettings.setNumber("Age", 42);
100+
console.log(localSettings.getNumber("Age")); // Prints 42
101+
console.log(localSettings.hasKey("Name")); // Prints true
102+
localSettings.remove("Name"); // Removes the Name entry.
103+
console.log(localSettings.hasKey("Name")); // Prints false
104+
}
105+
exports.pageLoaded = pageLoaded;
106+
```
107+
``` TypeScript
108+
import observable = require("data/observable");
109+
import localSettings = require("local-settings");
110+
// Event handler for Page "loaded" event attached in main-page.xml
111+
export function pageLoaded(args: observable.EventData) {
112+
localSettings.setString("Name", "John Doe");
113+
console.log(localSettings.getString("Name"));// Prints "John Doe"
114+
localSettings.setBoolean("Married", false);
115+
console.log(localSettings.getBoolean("Married"));// Prints false
116+
localSettings.setNumber("Age", 42);
117+
console.log(localSettings.getNumber("Age"));// Prints 42
118+
console.log(localSettings.hasKey("Name"));// Prints true
119+
localSettings.remove("Name");// Removes the Name entry.
120+
console.log(localSettings.hasKey("Name"));// Prints false
121+
}
110122
```

layouts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
nav-title: "NativeScript Layouts"
33
title: "Layouts"
44
description: "NativeScript Documentation: Layouts"
5-
position: 3
5+
position: 4
66
---
77

88
# Layouts

location.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
nav-title: "Location"
33
title: "Location"
44
description: "NativeScript Documentation: Location"
5-
position: 8
5+
position: 10
66
---
77

88
# Location

navigation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
nav-title: "Navigation"
33
title: "Navigation"
44
description: "Navigation"
5-
position: 0
5+
position: 3
6+
67
---
78
# Overview
89
Each NativeScript application is built upon the concept of pages (represented by the **Page** class). Pages are the different screens that your application offers. Each page has a **content** property which holds the root visual element of the page UI. Navigating between different pages is done with methods of the **Frame** class. The Frame class represents the logical unit that is responsible for navigation between different pages, i.e. going from one page to another, keeping a history stack for going back and so on.

styling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
nav-title: "NativeScript Styling"
33
title: "Styling"
44
description: "NativeScript Documentation: Styling"
5-
position: 7
5+
position: 5
66
---
77

88
# Styling

ui-dialogs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
nav-title: "UI Dialogs"
33
title: "UI Dialogs"
44
description: "NativeScript Documentation: UI Dialogs"
5-
position: 101
5+
position: 9
66
---
77

88
# UI Dialogs

ui-views.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
#UI Views
1+
---
2+
nav-title: "UI Views"
3+
title: "UI Views"
4+
description: "UI Views"
5+
position: 8
6+
---
27

38
NativeScript ships with set of UI Views which can be used for building the UI of a mobile application. Most of these views wrap the corresponding native view for each platform, while providing a common API for working with them. For example the `Button` view renders an `android.widget.Button` on Android and `UIButton` on iOS.
49

ui-with-xml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
nav-title: "UI with XML"
33
title: "UI with XML"
44
description: "NativeScript Documentation: UI with XML"
5-
position: 5
5+
position: 7
66
---
77

88
# UI with XML

0 commit comments

Comments
 (0)