Content-Length: 860048 | pFad | http://github.com/NativeScript/docs-v8/commit/5e28dffc607bcd93aadf34c6bacb9cfc374d9070

F7 use vitepress title blocks · NativeScript/docs-v8@5e28dff · GitHub
Skip to content

Commit 5e28dff

Browse files
committed
use vitepress title blocks
1 parent b033e57 commit 5e28dff

10 files changed

+129
-47
lines changed

Diff for: advanced-concepts.md

+52-20
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@ For the Objective-C/Swift symbols to be accessible by the Nativescript runtimes
1414

1515
The first task is done by the NativeScript CLI by adding the source files to the generated _.xcodeproj_. For the second one the Metadata Generator needs to find a [module.modulemap](https://clang.llvm.org/docs/Modules.html) of the compiled modules.
1616

17-
**Note:** For _.swift_ files _module.modulemap_ is not required.
17+
::: warning Note
18+
For _.swift_ files _module.modulemap_ is not required.
19+
:::
1820

1921
In order to satisfy the above constraints the developer has to:
2022

2123
**1)** Place the source files in _App_Resources/iOS/src/_
2224

2325
**2)** Create a modulemap for the Objective-C files
2426

25-
**Note:** Swift classes need to be accessible from the Objective-C runtime in order to be used from NativeScript. This can be done by using the _@objc_ attribute or by inheriting _NSObject_.
27+
::: warning Note
28+
Swift classes need to be accessible from the Objective-C runtime in order to be used from NativeScript. This can be done by using the _@objc_ attribute or by inheriting _NSObject_.
29+
:::
2630

2731
For a detailed walkthrough on how to use native iOS source code in NativeScript [here](https://www.nativescript.org/blog/adding-objective-c-code-to-a-nativescript-app).
2832

@@ -238,7 +242,9 @@ FloatArraySample.dumpFloats(CGFloatArray.from(jsArray), jsArray.length);
238242
@end
239243
```
240244

241-
> Note: Keep in mind that `CGFloat` is architecture dependent. On 32-bit devices, we need to use `Float32Array` and `Float64Array` -- on 64-bit ones. A straightforward way to verify the device/emulator architecture is to check the pointer size via `interop.sizeof(interop.types.id)`. The return value for the pointer size will be 4 bytes for 32-bit architectures and 8 bytes - for 64-bit ones. For further info, check out [CGFloat's documentation](https://developer.apple.com/documentation/coregraphics/cgfloat).
245+
::: warning Note
246+
Keep in mind that `CGFloat` is architecture dependent. On 32-bit devices, we need to use `Float32Array` and `Float64Array` -- on 64-bit ones. A straightforward way to verify the device/emulator architecture is to check the pointer size via `interop.sizeof(interop.types.id)`. The return value for the pointer size will be 4 bytes for 32-bit architectures and 8 bytes - for 64-bit ones. For further info, check out [CGFloat's documentation](https://developer.apple.com/documentation/coregraphics/cgfloat).
247+
:::
242248

243249
### Primitive Exceptions
244250

@@ -499,34 +505,38 @@ var myObject = new MyObject()
499505
myObject.myMethod(10) // myMethod(int) will be called.
500506
```
501507

502-
> **Note:** If there is no myMethod(int) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
508+
::: warning Note
509+
If there is no myMethod(int) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
510+
:::
503511

504512
- Implicit **floating-point** conversion:
505513

506514
```javascript
507515
myObject.myMethod(10.5) // myMethod(double) will be called.
508516
```
509517

510-
> **Note:** If there is no myMethod(double) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
518+
::: warning Note
519+
If there is no myMethod(double) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
520+
:::
511521

512522
- Explicitly call an overload: <br/>
513523
To enable developers call a specific method overload, the Runtime exposes the following functions directly in the global context:
514524

515525
* byte(number) → Java primitive byte
516526

517-
>The number value will be truncated and only its first byte of the whole part will be used.
527+
> The number value will be truncated and only its first byte of the whole part will be used.
518528

519529
* short(number) → Java primitive short
520530

521-
>The number value will be truncated and only its first 2 bytes of the whole part will be used.
531+
> The number value will be truncated and only its first 2 bytes of the whole part will be used.
522532

523533
* float(number) → Java primitive float
524534

525-
>The number value will be converted (with a possible precision loss) to a 2^32 floating-point value.
535+
> The number value will be converted (with a possible precision loss) to a 2^32 floating-point value.
526536

527537
* long(number) → Java primitive long (in case the number literal fits JavaScript 2^53 limit)
528538

529-
>The number value's whole part will be taken only.
539+
> The number value's whole part will be taken only.
530540

531541
* long("number") → Java primitive long (in case the number literal doesn't fit JavaScript 2^53 limit)
532542

@@ -538,7 +548,9 @@ myObject.myMethod(long(10)) // will call myMethod(long)
538548
myObject.myMethod(long('123456')) // will convert "123456" to Java long and will call myMethod(long)
539549
```
540550

541-
> **Note:** When an explicit cast function is called and there is no such implementation found, the Runtime will directly fail, without trying to find a matching overload.
551+
::: warning Note
552+
When an explicit cast function is called and there is no such implementation found, the Runtime will directly fail, without trying to find a matching overload.
553+
:::
542554

543555
#### Array
544556

@@ -621,15 +633,19 @@ var myObject = new MyObject()
621633
myObject.myMethod(10) // myMethod(Int) will be called.
622634
```
623635

624-
> **Note:** If there is no myMethod(Int) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
636+
::: warning Note
637+
If there is no myMethod(Int) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
638+
:::
625639

626640
- Implicit **floating-point** conversion:
627641

628642
```javascript
629643
myObject.myMethod(10.5) // myMethod(Double) will be called.
630644
```
631645

632-
> **Note:** If there is no myMethod(Double) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
646+
::: warning Note
647+
If there is no myMethod(Double) implementation, the Runtime will try to choose the best possible overload with least conversion loss. If no such method is found an exception will be raised.
648+
:::
633649

634650
- Explicitly call an overload: <br/>
635651
To enable developers call a specific method overload, the Runtime exposes the following functions directly in the global context:
@@ -660,7 +676,9 @@ myObject.myMethod(long(10)) // will call myMethod(Long)
660676
myObject.myMethod(long('123456')) // will convert "123456" to Kotlin Long and will call myMethod(Long)
661677
```
662678

663-
> **Note:** When an explicit cast function is called and there is no such implementation found, the Runtime will directly fail, without trying to find a matching overload.
679+
::: warning Note
680+
When an explicit cast function is called and there is no such implementation found, the Runtime will directly fail, without trying to find a matching overload.
681+
:::
664682

665683
#### Array
666684

@@ -789,7 +807,9 @@ var files = directory.listFiles() // files is a special object as described abov
789807
var singleFile = files[0] // the indexed getter callback is triggered and a proxy object over the java.io.File is returned
790808
```
791809

792-
> **Note:** A Java Array is intentionally not converted to a JavaScript [Array](http://www.w3schools.com/jsref/jsref_obj_array.asp) for the sake of performance, especially when it comes to large arrays.
810+
::: warning Note
811+
A Java Array is intentionally not converted to a JavaScript [Array](http://www.w3schools.com/jsref/jsref_obj_array.asp) for the sake of performance, especially when it comes to large arrays.
812+
:::
793813

794814
#### Array of Objects
795815

@@ -1082,7 +1102,9 @@ class KotlinClassWithStringArrayProperty {
10821102
}
10831103
```
10841104

1085-
> **Note:** A Kotlin Array is intentionally not converted to a JavaScript [Array](http://www.w3schools.com/jsref/jsref_obj_array.asp) for the sake of performance, especially when it comes to large arrays.
1105+
::: warning Note
1106+
A Kotlin Array is intentionally not converted to a JavaScript [Array](http://www.w3schools.com/jsref/jsref_obj_array.asp) for the sake of performance, especially when it comes to large arrays.
1107+
:::
10861108

10871109
#### Creating arrays
10881110

@@ -1281,7 +1303,9 @@ Workers API in NativeScript is loosely based on the [Dedicated Web Workers API](
12811303

12821304
![NativeScript Workers API](/assets/images/multithreading/Workers.png)
12831305

1284-
> Note: In order to use `console`'s methods, setTimeout/setInterval, or other functionality coming from the core-modules package, the `globals` module needs to be imported manually to bootstrap the infrastructure on the new worker thread.
1306+
::: warning Note
1307+
In order to use `console`'s methods, setTimeout/setInterval, or other functionality coming from the core-modules package, the `globals` module needs to be imported manually to bootstrap the infrastructure on the new worker thread.
1308+
:::
12851309

12861310
main-view-model.js
12871311

@@ -1431,7 +1455,9 @@ if (android.os.Build.VERSION.SDK_INT >= 21) {
14311455

14321456
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.
14331457

1434-
> Note: 'Android classes' and 'Java/Kotlin classes' are used interchangeably throughout the article to refer to classes in the Java/Kotlin programming language.
1458+
::: warning Note
1459+
'Android classes' and 'Java/Kotlin classes' are used interchangeably throughout the article to refer to classes in the Java/Kotlin programming language.
1460+
:::
14351461

14361462
#### Access Android Packages
14371463

@@ -1464,11 +1490,17 @@ To find out the package name of an Android class, refer to the [Android SDK Refe
14641490

14651491
For example, if you need to work with the Google API for Google Maps, after following the installation guide, you may need to access packages from the plugin like `com.google.android.gms.maps`, which you can find a reference for at [Google APIs for Android Reference](https://developers.google.com/android/reference/com/google/android/gms/maps/package-summary)
14661492

1467-
> **Note:** To have access and Intellisense for the native APIs with **NativeScript + TypeScript** or **NativeScript + Angular** projects, you have to add a dev dependency to `@nativescript/types`. More details about accessing native APIs with TypeScript can be found [here]({% slug access-native-apis %}#intellisense-and-access-to-native-apis-via-typescript).
1493+
::: warning Note
1494+
To have access and Intellisense for the native APIs with **NativeScript + TypeScript** or **NativeScript + Angular** projects, you have to add a dev dependency to `@nativescript/types`. More details about accessing native APIs with TypeScript can be found [here]({% slug access-native-apis %}#intellisense-and-access-to-native-apis-via-typescript).
1495+
:::
14681496

1469-
> **Note:** **(Experimental)** Alternatively, to get Intellisense for the native APIs based on the available Android Platform SDK and imported Android Support packages (added by default to your Android project), supply the `--androidTypings` flag with your `tns run | build android` command. The resulting `android.d.ts` file can then be used to provide auto-completion.
1497+
::: warning Note
1498+
**(Experimental)** Alternatively, to get Intellisense for the native APIs based on the available Android Platform SDK and imported Android Support packages (added by default to your Android project), supply the `--androidTypings` flag with your `tns run | build android` command. The resulting `android.d.ts` file can then be used to provide auto-completion.
1499+
:::
14701500

1471-
> **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).
1501+
::: warning Note
1502+
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).
1503+
:::
14721504

14731505
#### Access Android Classes
14741506

Diff for: interaction.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ In some scenarios, you would want to disable the user interaction or to create m
286286

287287
- `isPassThroughParentEnabled` - Gets or sets a value indicating whether touch events should pass through to a parent view of the layout container in case an interactive child view did not handle the event. Does not affect the appearance of the view. The default value is `false`.
288288

289-
> **Note: **: There is a conceptual difference in how `isEnabled` is acting on Android and iOS. On Android, the `isEnabled` set to `false` (e.g., on Button) won't allow any events to pass through even when `isPassThroughParentEnabled` is set to `true` for its parent. On the contrary on iOS, the same setup will pass through the event to the parent.
289+
::: warning Note
290+
There is a conceptual difference in how `isEnabled` is acting on Android and iOS. On Android, the `isEnabled` set to `false` (e.g., on Button) won't allow any events to pass through even when `isPassThroughParentEnabled` is set to `true` for its parent. On the contrary on iOS, the same setup will pass through the event to the parent.
291+
:::
290292

291293
Playground application demonstrating the usage of the three properties can be found [here](https://play.nativescript.org/?template=play-tsc&id=6c9GA0).
292294

@@ -1018,7 +1020,9 @@ view.animate({
10181020
});
10191021
```
10201022

1021-
> Note: The properties `origenX` and `origenY` are JavaScript properties and can be assigned via code-behind only via a given `View` reference. We can still use them along with CSS animations, but the values for `origenX` and `origenY` must be set in the code-behind logic.
1023+
::: warning Note
1024+
The properties `origenX` and `origenY` are JavaScript properties and can be assigned via code-behind only via a given `View` reference. We can still use them along with CSS animations, but the values for `origenX` and `origenY` must be set in the code-behind logic.
1025+
:::
10221026

10231027
### Limitations
10241028

Diff for: networking.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ Http.getFile('https://d1lfyz5kwt8vu9.cloudfront.net/nativescript-logo-2021.png')
107107
)
108108
```
109109

110-
> Note: By default the file will be saved in Documents folder.
110+
::: warning Note
111+
By default the file will be saved in Documents folder.
112+
:::
111113

112114
In the `getFile` method we could also specify the path, where the file to be saved. This scenario is demonstrated in the example below, where the image file will be kept in the current application folder.
113115

Diff for: performance.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ In contrast, when using `ImageSource` or Base64 encoded string, the Bitmap is tr
3030

3131
As an additional feature for Android, NativeScript supports `decodeWidth` and `decodeHeight`. These properties will **downsample** your image so that it will take less memory. The goal is to avoid as much as possible out of memory exceptions caused by images being loaded into memory and at the same time display crispy images.
3232

33-
> **Note:** Use `decodeWidth` and `decodeHeight` only when working with large photos and there are `Out of Memory` exceptions issues. With NativeScript 3.x.x and above, image optimizations were implemented and in the common scenarios, you should not worry about hitting OOM.
33+
::: warning Note
34+
Use `decodeWidth` and `decodeHeight` only when working with large photos and there are `Out of Memory` exceptions issues. With NativeScript 3.x.x and above, image optimizations were implemented and in the common scenarios, you should not worry about hitting OOM.
35+
:::
3436

3537
When working with the decode properties, the following considerations should be taken:
3638

@@ -42,7 +44,7 @@ When working with the decode properties, the following considerations should be
4244

4345
- Image caching now takes into account the `decodeWidth` and `decodeHeight` values. Identical images with different decode property values will now be retrieved and saved separately in the cache. This results in better quality images. If you have a small version of the image in a master list and want to decode it with 100 x 100 DP, and then want to display it in 1000 x 1000 DP on the detail page, the detailed image will now not be blurry. This also means you can now control caching - using the same image with the same decode parameter values will still get the image from the cache.
4446

45-
> **Important**: The `decodeWidth` and `decodeHeight` properties will work only for Android. Setting them for our iOS images will not change the application behaviour in any way.
47+
> **Important**: The `decodeWidth` and `decodeHeight` properties will work only for Android. Setting them for our iOS images will not change the application behavior in any way.
4648
4749
### Using `loadMode` property
4850

@@ -57,13 +59,17 @@ With [loadMode](/api-reference/modules/_ui_image_.html#loadmode) set to `async`,
5759
</StackLayout>
5860
```
5961

60-
> **Note**: When the `src` value starts with `http` it will be loaded asynchronously no matter what value is set to `loadMode`.
62+
::: warning Note
63+
When the `src` value starts with `http` it will be loaded asynchronously no matter what value is set to `loadMode`.
64+
:::
6165

6266
### Using `useCache` property
6367

6468
The `Image` module will use internal memory and disk cache, so when loaded the module stores the images in the memory cache, and when they are not needed anymore, the `Image` module saves the images in the disk cache. This way the next time the application needs the same image NativeScript will load it from memory or the disk cache. Setting property `useCache` to `false` could be used to bypass image cache and load the image as it is on the first request to the specified URL.
6569

66-
> **Note**: The property `useCache` will work only for Android. Setting it for our iOS images will not change the application behaviour in any way.
70+
::: tip Tip
71+
The property `useCache` will work only for Android. Setting it for our iOS images will not change the application behavior in any way.
72+
:::
6773

6874
**API Reference for** [Image Module](/api-reference/modules/_ui_image_.html)
6975

Diff for: plugins/background-http.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ node server 8080
154154

155155
The above commands will start a server listening on port 8080. Remember to update the URL in your app to match the address/port where the server is running.
156156

157-
> Note: If you are using the iOS simulator then `http://localhost:8080` should be used to upload to the demo server. If you are using an Android emulator, `http://10.0.2.2:8080` should be used instead.
157+
::: warning Note
158+
If you are using the iOS simulator then `http://localhost:8080` should be used to upload to the demo server. If you are using an Android emulator, `http://10.0.2.2:8080` should be used instead.
159+
:::
158160

159161
## License
160162

0 commit comments

Comments
 (0)








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/commit/5e28dffc607bcd93aadf34c6bacb9cfc374d9070

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy