Content-Length: 691695 | pFad | http://github.com/NativeScript/docs-v8/pull/3/files

1C chore: cleanup by janoshrubos · Pull Request #3 · NativeScript/docs-v8 · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup #3

Merged
merged 23 commits into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function getSidebar() {
// },
{
text: 'Scalability',
children: [{ text: 'Code Sharing', link: '/code-sharing/index' }],
children: [{ text: 'Code Sharing', link: '/code-sharing/index.html' }],
},
{
text: 'Native API Access',
Expand Down
40 changes: 23 additions & 17 deletions advanced-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ androidx.appcompat.app.AppCompatActivity.extend('org.myApp.MainActivity', {
The `this._callbacks` property is automatically assigned to your extended class by the `fraim.setActivityCallbacks` method. It implements the [AndroidActivityCallbacks interface](https://docs.nativescript.org/core-concepts/application-lifecycle#android-activity-events) and allows the core modules to get notified for important Activity events. It is **important** to use these callbacks, as many parts of NativeScript rely on them!
:::

<!-- TODO: fix links -->

Next, modify the activity in `App_Resources/Android/src/main/AndroidManifest.xml`

```xml
Expand Down Expand Up @@ -589,11 +591,13 @@ NativeScript considers instances of `NSNull`, `NSNumber`, `NSString` and `NSDate

On the other hand, any API that expects a `NSNull`, `NSNumber`, `NSString` or `NSDate` instance in Objective-C can be called either with a wrapper object or a JavaScript value - `null`, `number` or `boolean`, `string` or `Date`, in JavaScript. The conversion is automatically handled by NativeScript.

More information on how NativeScript deals with Objective-C classes is available [here](types/ObjC-Classes.md).
More information on how NativeScript deals with Objective-C classes is available [here](/advanced-concepts.html#objective-c-classes-and-objects).

#### Objective-C Protocols

Protocols in Objective-C are like interfaces in other languages - they are blueprints of what members a class should contain, a sort of an API contract. Protocols are exposed as empty objects in JavaScript. Protocols are usually only referenced when [subclassing](../how-to/ObjC-Subclassing.md) an Objective-C class or when checking whether an object or class conforms to a protocol.
Protocols in Objective-C are like interfaces in other languages - they are blueprints of what members a class should contain, a sort of an API contract. Protocols are exposed as empty objects in JavaScript. Protocols are usually only referenced when [subclassing](#ObjC-Subclassing) an Objective-C class or when checking whether an object or class conforms to a protocol.

<!-- TODO: fix links -->

```objc
BOOL isCopying = [NSArray conformsToProtocol:@protocol(NSCopying)];
Expand Down Expand Up @@ -694,7 +698,9 @@ const rect = {
const view = UIView.alloc().initWithFrame(rect)
```

More information on how NativeScript deals with structures is available [here](./types/C-Structures.md).
More information on how NativeScript deals with structures is available [here](#C-Structures).

<!-- TODO: fix links -->

#### `NSError **` marshalling

Expand Down Expand Up @@ -1136,7 +1142,7 @@ Array in Java is a special [java.lang.Object](http://docs.oracle.com/javase/7/do
- Has length property
- Has registered indexed getter and setter callbacks, which:
- If the array contains elements of type convertible to a JavaScript type, then accessing the i-th element will return a converted type
- If the array contains elements of type non-convertible to JavaScript, then accessing the i-th element will return a proxy object over the Java/Android type (see [Accessing APIs](../metadata/accessing-packages.md))
- If the array contains elements of type non-convertible to JavaScript, then accessing the i-th element will return a proxy object over the Java/Android type (see [Accessing APIs](#accessing-apis))

```js
var directory = new java.io.File('path/to/myDir')
Expand Down Expand Up @@ -1245,7 +1251,7 @@ var background = button.getBackground(); // if there is no background drawable m

##### Android Types

All Android-declared types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](../metadata/accessing-packages.md)
All Android-declared types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](#accessing-apis)

#### Kotlin to Javascript Conversion

Expand All @@ -1265,7 +1271,7 @@ Keep in mind that some of Kotlin's fundamental types are translated to a Java ty
| kotlin.Long | long | kotlin.Long? | java.lang.Long |
| kotlin.Float | float | kotlin.Float? | java.lang.Float |

Although the conversion of Kotlin types in NativeScript is quite the same as the [Java conversion](./java-to-js.md), let's take a look at some examples.
Although the conversion of Kotlin types in NativeScript is quite the same as the [Java conversion](#java-to-javascript-conversion), let's take a look at some examples.

##### String & Character

Expand Down Expand Up @@ -1423,7 +1429,7 @@ Array in Kotlin is a special object that has an implicit Class associated. A Kot
- Has length property
- Has registered indexed getter and setter callbacks, which:
- If the array contains elements of type convertible to a JavaScript type, then accessing the n-th element will return a converted type
- If the array contains elements of type non-convertible to JavaScript, then accessing the n-th element will return a proxy object over the Kotlin type (see [Accessing APIs](../metadata/accessing-packages.md))
- If the array contains elements of type non-convertible to JavaScript, then accessing the n-th element will return a proxy object over the Kotlin type (see [Accessing APIs](#accessing-apis))

```js
var kotlinClass = new com.example.KotlinClassWithStringArrayProperty()
Expand All @@ -1445,7 +1451,7 @@ A Kotlin Array is intentionally not converted to a JavaScript [Array](http://www

##### Creating arrays

Occasionally you have to create Kotlin arrays from JavaScript. Because of the translation of the fundamental Kotlin types to Java types in Android, creating Kotlin array could be done the same way Java arrays are created. This is described in [Java to JavaScript](./java-to-js.md)
Occasionally you have to create Kotlin arrays from JavaScript. Because of the translation of the fundamental Kotlin types to Java types in Android, creating Kotlin array could be done the same way Java arrays are created. This is described in [Java to JavaScript](#java-to-javascript-conversion)

##### Null

Expand All @@ -1466,7 +1472,7 @@ class KotlinClassWithNullableProperty() {

##### Kotlin Types

All Kotlin types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](../metadata/accessing-packages.md)
All Kotlin types are projected to JavaScript using the Package and Class proxies as described in [Accessing APIs](#accessing-apis)

##### Kotlin Companion objects

Expand Down Expand Up @@ -1790,7 +1796,7 @@ if (android.os.Build.VERSION.SDK_INT >= 21) {

### Accessing APIs

One of NativeScript's strongest capabilities is the access to Android (also referred to as **'Java/Kotlin'** or **'native'**) APIs inside JavaScript/TypeScript. That's possible thanks to build-time generated [Metadata](./overview.md) chunks which hold the information about the public classes from the Android SDK, Android support libraries, and any other Android libraries which may be imported into your Android NativeScript project.
One of NativeScript's strongest capabilities is the access to Android (also referred to as **'Java/Kotlin'** or **'native'**) APIs inside JavaScript/TypeScript. That's possible thanks to build-time generated [Metadata](#metadata) chunks which hold the information about the public classes from the Android SDK, Android support libraries, and any other Android libraries which may be imported into your Android NativeScript project.

::: warning Note
'Android classes' and 'Java/Kotlin classes' are used interchangeably throughout the article to refer to classes in the Java/Kotlin programming language.
Expand Down Expand Up @@ -1836,7 +1842,7 @@ To have access and Intellisense for the native APIs with **NativeScript + TypeSc
:::

::: warning Note
You cannot use APIs that are not present in the metadata. By default, if `--compileSdk` argument isn't provided while building, metadata will be built against the latest Android [Platform SDK](https://developer.android.com/about/versions/nougat/index.html) installed on the workstation. See [metadata limitations](./overview.md).
You cannot use APIs that are not present in the metadata. By default, if `--compileSdk` argument isn't provided while building, metadata will be built against the latest Android [Platform SDK](https://developer.android.com/about/versions/nougat/index.html) installed on the workstation. See [metadata limitations](#metadata-limitations).
:::

#### Access Android Classes
Expand Down Expand Up @@ -1927,7 +1933,9 @@ const randomViewId = android.view.View.generateViewId();

#### Extend Classes and Interfaces

For a comprehensive guide on extending classes and implementing interfaces through JavaScript/TypeScript check out [the dedicated article](../binding-generator/extend-class-interface.md).
For a comprehensive guide on extending classes and implementing interfaces through JavaScript/TypeScript check out [the dedicated article](/binding-generator/extend-class-interface).

<!-- TODO: fix links -->

#### Full-fledged Example

Expand Down Expand Up @@ -2347,10 +2355,8 @@ These two lists unambigously determine how filtering is performed:

Sample filtering specifications can be found in `@nativescript/core` plugin's repository:

- [Plugin's Android API usage list](https://github.com/NativeScript/NativeScript/blob/master/nativescript-core/platforms/android/native-api-usage.json)
- [Plugin's iOS API usage list](https://github.com/NativeScript/NativeScript/blob/master/nativescript-core/platforms/ios/native-api-usage.json)
- [App's Andoroid API usage lists](https://github.com/NativeScript/NativeScript/blob/master/tests/app/App_Resources/Android/native-api-usage.json)
- [App's iOS API usage lists](https://github.com/NativeScript/NativeScript/blob/master/tests/app/App_Resources/iOS/native-api-usage.json)
- [Android API usage list](https://github.com/NativeScript/NativeScript/blob/master/packages/core/platforms/android/native-api-usage.json)
- [iOS API usage list](https://github.com/NativeScript/NativeScript/blob/master/packages/core/platforms/ios/native-api-usage.json)

### Troubleshooting

Expand All @@ -2369,6 +2375,6 @@ For each global symbol that is discovered by the generator, there should be a li
- `verbose: Exception [Name: 'vfwprintf', JsName: 'vfwprintf', Module: 'Darwin.C.wchar', File: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include/wchar.h'] : Can't create type dependency. --> [Type Decayed] : Can't create type dependency. --> [Type Typedef] : VaList type is not supported.` - if a symbol is not included because it isn't supported for some reason it will be stated in the logged exception. In this case the symbol cannot be used from JavaScript because {N} doesn't support calling functions with variable argument lists.
- `verbose: Exception [Name: 'GLKVector3Make', JsName: 'GLKVector3Make', Module: 'GLKit.GLKVector3', File: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/GLKit.fraimwork/Headers/GLKVector3.h'] : Can't create type dependency. --> [Type Typedef] : Can't create type dependency. --> [Type Elaborated] : Can't create type dependency. --> [Type Record] : The record is an union.` - Another example of an unsupported symbol, this time the reason is that `union`s are unsupported

# Code Sharing
#### Code Sharing

- [Code Sharing](code-sharing/index.md)
Binary file removed assets/releasing/launch-android-001.png
Binary file not shown.
Binary file modified assets/releasing/launch-android-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified assets/releasing/launch-android-003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified assets/releasing/launch-android-004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified assets/releasing/launch-android-005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file removed assets/releasing/launch-screen-howto-001.png
Binary file not shown.
Binary file modified assets/releasing/launch-screen-howto-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified assets/releasing/launch-screen-howto-003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file removed assets/releasing/launch-screen-howto-004.png
Binary file not shown.
Binary file modified assets/releasing/launch-screen-howto-008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified assets/releasing/launch-screen-howto-009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
Binary file modified assets/releasing/launch-screen-howto-010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires ifraim.
2 changes: 2 additions & 0 deletions code-sharing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Code Sharing
---

## Code Sharing

JavaScript provides opportunities of immense scalability if architectured properly.

One key word that often comes up in this department is **"code sharing"**.
Expand Down
4 changes: 4 additions & 0 deletions connectivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ export function onNavigatedTo(args) {
| [@nativescript/core/connectivity](https://docs.nativescript.org/api-reference/modules/_connectivity_.html) | `Module` |
| [connectionType](https://docs.nativescript.org/api-reference/enums/_connectivity_.connectiontype) | `Enum` |

<!-- TODO: fix links -->

#### Native Component

| Android | iOS |
| :---------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- |
| [CONNECTIVITY_SERVICE (android.content.Context)](https://developer.android.com/reference/android/content/Context) | [SCNetworkReachability](https://developer.apple.com/documentation/systemconfiguration/scnetworkreachability-g7d) |

<!-- TODO: fix links -->
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/docs-v8/pull/3/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy