Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 469929d

Browse files
committed
Removed broken/inconsistent links (API reference sections ) from http.md and connectivity.md and instead made them complete,no need to point other pages
1 parent c7e2507 commit 469929d

File tree

4 files changed

+116
-31
lines changed

4 files changed

+116
-31
lines changed

‎.vitepress/config.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -534,27 +534,21 @@ function getSidebar() {
534534
{
535535
text: '@nativescript/core',
536536
children: [
537+
{ text: 'Application', link: '/nativescript-core/application' },
538+
//{text: 'ApplicationSettings',link: '/nativescript-core/application-settings'},
537539
{ text: 'Color', link: '/nativescript-core/color' },
538540
{ text: 'Connectivity', link: '/nativescript-core/connectivity' },
539-
{ text: 'Application', link: '/nativescript-core/application' },
540-
{
541-
text: 'ApplicationSettings',
542-
link: '/nativescript-core/application-settings',
543-
},
544-
{ text: 'Observable', link: '/nativescript-core/observable' },
545-
{
546-
text: 'Observable Array',
547-
link: '/nativescript-core/observable-array',
548-
},
549-
{ text: 'Virtual Array', link: '/nativescript-core/virtual-array' },
550-
{ text: 'File System', link: '/nativescript-core/file-system' },
551-
{ text: 'Fps Meter', link: '/nativescript-core/fps-meter' },
541+
//{ text: 'Observable', link: '/nativescript-core/observable' },
542+
//{text: 'Observable Array',link: '/nativescript-core/observable-array'},
543+
//{ text: 'Virtual Array', link: '/nativescript-core/virtual-array' },
544+
//{ text: 'File System', link: '/nativescript-core/file-system' },
545+
//{ text: 'Fps Meter', link: '/nativescript-core/fps-meter' },
552546
{ text: 'Http', link: '/nativescript-core/http' },
553-
{ text: 'Image Source', link: '/nativescript-core/image-source' },
554-
{ text: 'Platform', link: '/nativescript-core/platform' },
555-
{ text: 'Timer', link: '/nativescript-core/timer' },
556-
{ text: 'Trace', link: '/nativescript-core/trace' },
557-
{ text: 'Xml Parser', link: '/nativescript-core/xml-parser' },
547+
//{ text: 'Image Source', link: '/nativescript-core/image-source' },
548+
//{ text: 'Platform', link: '/nativescript-core/platform' },
549+
//{ text: 'Timer', link: '/nativescript-core/timer' },
550+
//{ text: 'Trace', link: '/nativescript-core/trace' },
551+
//{ text: 'Xml Parser', link: '/nativescript-core/xml-parser' },
558552
],
559553
},
560554
// {

‎nativescript-core/Application.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Application
3+
---
4+
5+
## Application
6+
7+
The Application module provides abstraction over the platform-specific Application implementations. The module lets you manage the lifecycle of your NativeScript applications from starting the application to handling application events and creating platform-specific logic, such as, sending Broadcasts on Android or adding a Notification observer on IOS.
8+
9+
#### Usage
10+
11+
/// flavor javascript
12+
13+
```javascript
14+
const applicationModule = require('@nativescript/core/application')
15+
```
16+
17+
///
18+
19+
/// flavor typescript
20+
21+
```typescript
22+
import { Application } from '@nativescript/core'
23+
```
24+
25+
///
26+
27+
## Android
28+
29+
The application module provides a number of Android specific properties to access the Android app, context and activities.
30+
31+
/// flavor javascript
32+
33+
```javascript
34+
const androidApp = applicationModule.android
35+
const isPaused = androidApp.paused // e.g. false
36+
const packageName = androidApp.packageName // The package ID e.g. org.nativescript.nativescriptsdkexamplesng
37+
const nativeApp = androidApp.nativeApp // The native APplication reference
38+
const foregroundActivity = androidApp.foregroundActivity // The current Activity reference
39+
const context = androidApp.context // The current Android context
40+
```
41+
42+
///
43+
44+
/// flavor typescript
45+
46+
```typescript
47+
48+
```
49+
50+
///
51+
52+
#### Registering a Broadcast Receiver
53+
54+
/// flavor javascript
55+
56+
```javascript
57+
if (applicationModule.isAndroid) {
58+
// use tns-platform-declarations to acces native APIs (e.g. android.content.Intent)
59+
const receiverCallback = (androidContext, intent) => {
60+
const level = intent.getIntExtra(android.os.BatteryManager.EXTRA_LEVEL, -1)
61+
const scale = intent.getIntExtra(android.os.BatteryManager.EXTRA_SCALE, -1)
62+
const percent = (level / scale) * 100.0
63+
vm.set('batteryLife', percent.toString())
64+
}
65+
66+
applicationModule.android.registerBroadcastReceiver(
67+
android.content.Intent.ACTION_BATTERY_CHANGED,
68+
receiverCallback
69+
)
70+
}
71+
```
72+
73+
///
74+
75+
/// flavor typescript
76+
77+
```typescript
78+
79+
```
80+
81+
///
82+
83+
#### Methods
84+
85+
| Name | Type | Description |
86+
| ---------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
87+
| `getConnectionType` | `number` | Gets the type of connection. Returns a value from the `connectivityModule.connectionType` enumeration. To use this method on Android you need to have the **android.permission.ACCESS_NETWORK_STATE** permission added to the **AndroidManifest.xml** file. |
88+
| `startMonitoring(connectionTypeChangedCallback: function)` | `void` | Starts monitoring the connection type. |
89+
| `stopMonitoring` | `void` | Stops monitoring the connection type. |
90+
91+
#### Connection Types
92+
93+
- `none = 0`,
94+
- `wifi = 1`,
95+
- `mobile = 2`,
96+
- `ethernet = 3`,
97+
- `bluetooth = 4`,
98+
- `vpn = 5`
99+
100+
#### Native Component
101+
102+
| Android | iOS |
103+
| :---------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- |
104+
| [CONNECTIVITY_SERVICE (android.content.Context)](https://developer.android.com/reference/android/content/Context) | [SCNetworkReachability](https://developer.apple.com/documentation/systemconfiguration/scnetworkreachability-g7d) |

‎nativescript-core/connectivity.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,6 @@ export function onNavigatedTo(args) {
8888
- `bluetooth = 4`,
8989
- `vpn = 5`
9090

91-
#### API References
92-
93-
| Name | Type |
94-
| --------------------------------------------------------------------------- | -------- |
95-
| [@nativescript/core/connectivity](/api-reference/modules.html#connectivity) | `Module` |
96-
| [connectionType](/api-reference/modules.html#connectivity) | `Enum` |
97-
9891
#### Native Component
9992

10093
| Android | iOS |

‎nativescript-core/http.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,3 @@ Http.request({
172172
| `getJSON<T>(url: string): Promise<T>` | `Promise<T>` | Downloads the content from the specified URL as a string and returns its JSON.parse representation. |
173173
| `getString(url: string): Promise<string>` | `Promise<string>` | Downloads the content from the specified URL as a string. |
174174
| `request(options: HttpRequestOptions): Promise<HttpResponse>` | `Promise<HttpResponse>` | Makes a generic http request using the provided options and returns a HttpResponse Object. |
175-
176-
#### API References
177-
178-
| Name | Type |
179-
| ---------------------------------------------------------------------------------------- | -------- |
180-
| [@nativescript/core/http](https://docs.nativescript.org/api-reference/modules.html#http) | `Module` |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /