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 a9ed9f8

Browse files
committed
style: fix lint errors
1 parent 86ab86b commit a9ed9f8

8 files changed

+390
-326
lines changed

β€Žcontent/core/color.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@ description: Create a color object with any color representation and use it in y
44
---
55

66
The `Color` class enables the creation of a color object:
7-
- using color components (alpha, red, green, blue) ranging from 0 to 255,
8-
- using various color representations like ARGB, color names, hex values, and more.
9-
7+
8+
- using color components (alpha, red, green, blue) ranging from 0 to 255,
9+
- using various color representations like ARGB, color names, hex values, and more.
10+
1011
The `ios` and `android` properties of the `Color` class instance return the native platform instance of [UIColor](https://developer.apple.com/documentation/uikit/uicolor) on iOS and [Color](https://developer.android.com/reference/android/graphics/Color) on Android.
1112

1213
## How to use the Color class
1314

1415
<!-- Preview: https://stackblitz.com/edit/nativescript-stackblitz-templates-x2y7k6?file=app/main-view-model.ts -->
16+
1517
### Create a color object from a hex value
1618

1719
```ts
18-
const color = new Color('#FF00CC');
19-
const colorShortHex = new Color('#F0C');
20+
const color = new Color('#FF00CC')
21+
const colorShortHex = new Color('#F0C')
2022
```
2123

2224
### Create a color object from an alpha value
2325

2426
```ts
25-
const colorARGB = new Color(100, 255, 100, 100);
27+
const colorARGB = new Color(100, 255, 100, 100)
2628
```
2729

2830
## Color API
@@ -36,25 +38,31 @@ Creates a color object. The Color class offers the following constructor overloa
3638
```ts
3739
const color = new Color(knownColor)
3840
```
41+
3942
Creates a Color instance from a known color name.
43+
4044
- `knownColor` : A color name string such as `'red'`, `'purple'`, `'orange'`.
4145

4246
```ts
4347
const color = new Color(hex)
4448
```
49+
4550
Creates a Color instance from a color hexidecimal code.
4651

4752
- `hex`: A string of a hexidecimal color value such as `'#fff'` or `'#FF00CC'`.
4853

4954
```ts
5055
const color = new Color(argb)
5156
```
57+
5258
Creates a Color instance from a number representing a color with an alpha.
53-
- `argb`: A number such as `4293377432` as, representing color.
59+
60+
- `argb`: A number such as `4293377432` as, representing color.
5461

5562
```ts
5663
const color = new Color(alpha: number, red: number, green:number, blue: number, type?: 'rgb' | 'hsl' | 'hsv')
5764
```
65+
5866
---
5967

6068
### a
@@ -100,7 +108,7 @@ Gets the Blue component of the color. This is a `read-only` property.
100108
### argb
101109

102110
```ts
103-
colorARGB: number = color.argb
111+
colorARGB: number = color.argb
104112
```
105113

106114
Gets the Argb Number representation of this color where each 8 bits represent a single color component. This is a `read-only` property.
@@ -120,7 +128,7 @@ Gets the Hexadecimal string representation of the color.
120128
### name
121129

122130
```ts
123-
colorName: string =color.name
131+
colorName: string =color.name
124132
```
125133

126134
Gets the known name of this instance. Defined only if it has been constructed from a known color name - e.g. "red".
@@ -157,7 +165,7 @@ A static Color class method that compares two `Color` instances and returns `tru
157165

158166
---
159167

160-
### Color.isValid()
168+
### Color.isValid()
161169

162170
```ts
163171
isValidColorValue: boolean = Color.isValid(value)
@@ -213,7 +221,7 @@ A static method that returns a new Color from HSV.
213221
color.equals(value)
214222
```
215223

216-
A Color instance method that checks whether the color instance on which the method is called equals the Color instance passed to the method.
224+
A Color instance method that checks whether the color instance on which the method is called equals the Color instance passed to the method.
217225

218226
---
219227

@@ -262,9 +270,10 @@ Returns the color's [luminance](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#r
262270
```ts
263271
colorWithAlpha: Color = color.setAlpha(a)
264272
```
273+
265274
Adds the specified alpha to the color instance on which the method is called and returns the result as a new Color instance.
266275

267-
`a` is a value between `0` and `255`.
276+
`a` is a value between `0` and `255`.
268277

269278
---
270279

@@ -377,6 +386,7 @@ colorSpinned: Color = color.spin(amount)
377386
Spins the hue by the given amount, from -`360` to `360`. Calling with `0`, `360`, or -`360` does nothing since it sets the hue back to what it was before.
378387

379388
---
389+
380390
### complement()
381391

382392
```ts
@@ -388,5 +398,6 @@ Returns a Color instance that is the complement of the current color.
388398
---
389399

390400
## Native Component
401+
391402
- `Android`: [android.graphics.Color](https://developer.android.com/reference/android/graphics/Color)
392403
- `iOS`: [UIColor](https://developer.apple.com/documentation/uikit/uicolor?language=objc)

β€Žcontent/core/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ next: false
2222
</li>
2323
</ul>
2424

25-
See also [API Reference](/api/).
25+
See also [API Reference](/api/).

β€Žcontent/guide/adding-native-code.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
title: Adding custom native code to a project
33
---
44

5-
6-
NativeScript allows you to access any native APIs anytime in your app. If the native API you need is not exposed through [@nativescript/core](https://docs.nativescript.org/understanding-packages#nativescript-core) or [third party plugins](https://market.nativescript.org/) or [@nativescript/* plugins](https://docs.nativescript.org/plugins/index.html)), you can add it to your project and access it right away in TypeScript.
7-
5+
NativeScript allows you to access any native APIs anytime in your app. If the native API you need is not exposed through [@nativescript/core](https://docs.nativescript.org/understanding-packages#nativescript-core) or [third party plugins](https://market.nativescript.org/) or [@nativescript/\* plugins](https://docs.nativescript.org/plugins/index.html)), you can add it to your project and access it right away in TypeScript.
86

97
1. Add native code to [App_Resources](/project-structure/app-resources). For example, see [Adding Java/Kotlin code to an application](/project-structure/app-resources#adding-java-kotlin-code-to-an-application) and [Adding ObjectiveC/Swift Code to an application](/project-structure/app-resources#adding-objectivec-swift-code-to-an-application)
108

119
2. Generate types for the added APIs
12-
For iOS types run:
10+
For iOS types run:
1311

1412
```cli
1513
ns typings ios

β€Žcontent/guide/error-handling.md

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@ NativeScript allows error handling to be set dependent on whether the app is in
1212

1313
```ts
1414
const errorHandler: TraceErrorHandler = {
15-
1615
handlerError(err) {
1716
throw err
18-
}
17+
},
1918
}
2019
```
2120

22-
**Prevent app crash**: Write the error message to the console and continue the execution of the app.
21+
**Prevent app crash**: Write the error message to the console and continue the execution of the app.
2322

2423
```ts
2524
const errorHandler: TraceErrorHandler = {
26-
2725
handlerError(err) {
2826
Trace.write(err, 'unhandled-error', type.error)
29-
}
27+
},
3028
}
3129
```
3230

@@ -36,10 +34,9 @@ const errorHandler: TraceErrorHandler = {
3634

3735
```ts
3836
const errorHandler: TraceErrorHandler = {
39-
4037
handlerError(err) {
4138
reportToAnalytics(err)
42-
}
39+
},
4340
}
4441
```
4542

@@ -55,12 +52,12 @@ Nativescript also allows the prevention of an app crash by disabling rethrowing
5552
ios: {
5653
...
5754
"discardUncaughtJsExceptions": true,
58-
55+
5956
},
6057
android: {
6158
...
6259
"discardUncaughtJsExceptions": true,
63-
60+
6461
},
6562
```
6663

@@ -71,18 +68,19 @@ To handle discarded exceptions, two options are available:
7168
```ts
7269
import { Application, DiscardedErrorEventData } from '@nativescript/core'
7370

74-
Application.on(Application.discardedErrorEvent, function (args: DiscardedErrorEventData) {
75-
const error = args.error
76-
77-
console.log('Received discarded exception: ')
78-
console.log(error.message)
79-
console.log(error.name)
80-
console.log(error.stack)
81-
console.log(error.nativeError)
82-
// for example, report the exception to an analytics solution here
83-
})
71+
Application.on(
72+
Application.discardedErrorEvent,
73+
function (args: DiscardedErrorEventData) {
74+
const error = args.error
75+
76+
console.log('Received discarded exception: ')
77+
console.log(error.message)
78+
console.log(error.name)
79+
console.log(error.stack)
80+
console.log(error.nativeError)
81+
// for example, report the exception to an analytics solution here
82+
}
83+
)
8484
```
8585

8686
- Assigning a one-argument function to `global.__onDiscardedError` which will receive the exception as a `NativeScriptError` instance.
87-
88-

0 commit comments

Comments
(0)

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /