Skip to content

Commit 211e3ca

Browse files
committed
fix: clean up snippets
1 parent 52fc603 commit 211e3ca

File tree

161 files changed

+2215
-1835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+2215
-1835
lines changed

content/best-practices/ios-tips.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let applePayController: PKPaymentAuthorizationViewController
1818

1919
applePayController =
2020
PKPaymentAuthorizationViewController.alloc().initWithPaymentRequest(
21-
paymentRequest
21+
paymentRequest,
2222
)
2323
applePayController.delegate =
2424
PKPaymentAuthorizationViewControllerDelegateImpl.initWithOwner(this)
@@ -32,7 +32,7 @@ let applePayControllerDelegate: PKPaymentAuthorizationViewControllerDelegateImpl
3232

3333
applePayController =
3434
PKPaymentAuthorizationViewController.alloc().initWithPaymentRequest(
35-
paymentRequest
35+
paymentRequest,
3636
)
3737
applePayControllerDelegate =
3838
PKPaymentAuthorizationViewControllerDelegateImpl.initWithOwner(this)

content/configuration/webpack.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ module.exports = (env) => {
324324
config.get('externals').concat([
325325
// add your own externals
326326
'some-external-dependency',
327-
])
327+
]),
328328
)
329329
})
330330

@@ -518,7 +518,7 @@ module.exports = (env) => {
518518
'ignoreWarnings',
519519
(config.get('ignoreWarnings') || []).concat([
520520
/a regex that matches the warning to suppress/,
521-
])
521+
]),
522522
)
523523
})
524524

@@ -577,7 +577,7 @@ module.exports = (webpack) => {
577577
.test(/\.something$/)
578578
.use('something-loader')
579579
.loader('something-loader')
580-
} /*, options */
580+
} /*, options */,
581581
)
582582
}
583583
```
@@ -641,7 +641,7 @@ webpack.chainWebpack(
641641
(config, env) => {
642642
config.set('somethingThatShouldBeSetLast', true)
643643
},
644-
{ order: 10 }
644+
{ order: 10 },
645645
)
646646
```
647647

content/core/application.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if (isAndroid) {
4747
const androidApp: AndroidApplication = Application.android
4848

4949
androidApp.unregisterBroadcastReceiver(
50-
android.content.Intent.ACTION_BATTERY_CHANGED
50+
android.content.Intent.ACTION_BATTERY_CHANGED,
5151
)
5252
}
5353
```
@@ -76,7 +76,7 @@ To add an iOS notification observer, follow the steps below:
7676
UIDeviceOrientationDidChangeNotification,
7777
(notification: NSNotification) => {
7878
//Handle the notification
79-
}
79+
},
8080
)
8181
```
8282

@@ -89,7 +89,7 @@ To remove a notification observer, use the `removeNotificationObserver` method o
8989
```ts
9090
iOSApp.removeNotificationObserver(
9191
observer,
92-
UIDeviceBatteryStateDidChangeNotification
92+
UIDeviceBatteryStateDidChangeNotification,
9393
)
9494
```
9595

@@ -350,7 +350,7 @@ const MyDelegate = (function (_super) {
350350
}
351351
MyDelegate.prototype.applicationDidFinishLaunchingWithOptions = function (
352352
application,
353-
launchOptions
353+
launchOptions,
354354
) {
355355
console.log('applicationWillFinishLaunchingWithOptions: ' + launchOptions)
356356
return true
@@ -372,7 +372,7 @@ class MyDelegate extends UIResponder implements UIApplicationDelegate {
372372

373373
applicationDidFinishLaunchingWithOptions(
374374
application: UIApplication,
375-
launchOptions: NSDictionary<string, any>
375+
launchOptions: NSDictionary<string, any>,
376376
): boolean {
377377
console.log('applicationWillFinishLaunchingWithOptions: ' + launchOptions)
378378

content/core/http.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Http.getString('https://httpbin.org/get').then(
1717
(result: string) => {
1818
// do something with the string response
1919
},
20-
(e) => {}
20+
(e) => {},
2121
)
2222
```
2323

@@ -30,7 +30,7 @@ Http.getJSON('https://httpbin.org/get').then(
3030
(result) => {
3131
console.log(result)
3232
},
33-
(e) => {}
33+
(e) => {},
3434
)
3535
```
3636

@@ -40,12 +40,12 @@ Use the [getFile()](#getfile) method for a GET request with a response as a [Fil
4040

4141
```ts
4242
Http.getFile(
43-
'https://art.nativescript.org/logo/export/NativeScript_Logo_Wide_White_Blue_Rounded_Blue.png'
43+
'https://art.nativescript.org/logo/export/NativeScript_Logo_Wide_White_Blue_Rounded_Blue.png',
4444
).then(
4545
(resultFile: File) => {
4646
// The returned result will be File object
4747
},
48-
(e) => {}
48+
(e) => {},
4949
)
5050
```
5151

@@ -56,7 +56,7 @@ Use the [getImage()](#getimage) method for a GET request with a response as an i
5656
```ts
5757
Http.getImage('https://httpbin.org/image/jpeg').then(
5858
(res: ImageSource) => {},
59-
(e) => {}
59+
(e) => {},
6060
)
6161
```
6262

@@ -83,7 +83,7 @@ Http.request({
8383
},
8484
(e) => {
8585
// error
86-
}
86+
},
8787
)
8888
```
8989

content/core/image-source.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const color = new Color('black')
5858
const imageSource: ImageSource = ImageSource.fromFontIconCodeSync(
5959
'\uf004',
6060
font,
61-
color
61+
color,
6262
)
6363
```
6464
@@ -206,7 +206,7 @@ Create an ImageSource from the specified local file or resource (if specified wi
206206
const imageSource: ImageSource = ImageSource.fromFontIconCodeSync(
207207
source,
208208
font,
209-
color
209+
color,
210210
)
211211
```
212212

content/core/utils.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To verify if a path is valid resource or local file path, use the [isFileOrResou
1212

1313
```ts
1414
const isPathValid: boolean = Utils.isFileOrResourcePath(
15-
'https://nativescript.org/'
15+
'https://nativescript.org/',
1616
) // false
1717

1818
// or
@@ -612,7 +612,7 @@ Gets the string id from a given resource name.
612612
```ts
613613
const paletteColor: number = Utils.android.resources.getPaletteColor(
614614
resourceName,
615-
Utils.android.getApplicationContext()
615+
Utils.android.getApplicationContext(),
616616
)
617617
```
618618

content/guide/animations.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ You can combine two animations in the `animation` property by using commas:
199199

200200
```css
201201
.view {
202-
animation: example 4s ease-in-out 2s infinite reverse, second-animation-example
203-
5s ease-out;
202+
animation:
203+
example 4s ease-in-out 2s infinite reverse,
204+
second-animation-example 5s ease-out;
204205
}
205206
```
206207

@@ -490,14 +491,14 @@ touchAnimation = {
490491
let animation = new lib.SpringAnimation(
491492
view.android,
492493
lib.DynamicAnimation().SCALE_X,
493-
float(0.95)
494+
float(0.95),
494495
)
495496
animation.setSpring(spring).setStartVelocity(0.7).setStartValue(1.0)
496497
animation.start()
497498
animation = new lib.SpringAnimation(
498499
view.android,
499500
lib.DynamicAnimation().SCALE_Y,
500-
float(0.95)
501+
float(0.95),
501502
)
502503
animation.setSpring(spring).setStartVelocity(0.7).setStartValue(1.0)
503504
animation.start()
@@ -516,14 +517,14 @@ touchAnimation = {
516517
let animation = new lib.SpringAnimation(
517518
view.android,
518519
lib.DynamicAnimation().SCALE_X,
519-
float(1)
520+
float(1),
520521
)
521522
animation.setSpring(spring).setStartVelocity(0.7).setStartValue(0.95)
522523
animation.start()
523524
animation = new lib.SpringAnimation(
524525
view.android,
525526
lib.DynamicAnimation().SCALE_Y,
526-
float(1)
527+
float(1),
527528
)
528529
animation.setSpring(spring).setStartVelocity(0.7).setStartValue(0.95)
529530
animation.start()

content/guide/error-handling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Application.on(
7979
console.log(error.stack)
8080
console.log(error.nativeError)
8181
// for example, report the exception to an analytics solution here
82-
}
82+
},
8383
)
8484
```
8585

content/guide/extending-classes-and-conforming-to-protocols-ios.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const MyViewController = UIViewController.extend(
4343
},
4444
{
4545
name: 'MyViewController',
46-
}
46+
},
4747
)
4848
```
4949

@@ -125,13 +125,13 @@ const MyViewController = UIViewController.extend(
125125
viewDidLoad: function () {
126126
// ...
127127
const aboutButton = UIButton.buttonWithType(
128-
UIButtonType.UIButtonTypeRoundedRect
128+
UIButtonType.UIButtonTypeRoundedRect,
129129
)
130130
// Pass this target and the aboutTap selector for touch up callback.
131131
aboutButton.addTargetActionForControlEvents(
132132
this,
133133
'aboutTap',
134-
UIControlEvents.UIControlEventTouchUpInside
134+
UIControlEvents.UIControlEventTouchUpInside,
135135
)
136136
// ...
137137
},
@@ -149,7 +149,7 @@ const MyViewController = UIViewController.extend(
149149
// Declare the signature of the aboutTap. We can not infer it, since it is not inherited from base class or protocol.
150150
aboutTap: { returns: interop.types.void, params: [UIControl] },
151151
},
152-
}
152+
},
153153
)
154154
```
155155

@@ -181,7 +181,7 @@ const MyAppDelegate = UIResponder.extend(
181181
// We will obtain the method signature from the protocol.
182182
applicationDidFinishLaunchingWithOptions: function (
183183
application,
184-
launchOptions
184+
launchOptions,
185185
) {
186186
this._window = new UIWindow(UIScreen.mainScreen.bounds)
187187
this._window.rootViewController = MyViewController.alloc().init()
@@ -194,7 +194,7 @@ const MyAppDelegate = UIResponder.extend(
194194
name: 'MyAppDelegate',
195195
// Declare that the native Objective-C class will implement the UIApplicationDelegate Objective-C protocol.
196196
protocols: [UIApplicationDelegate],
197-
}
197+
},
198198
)
199199
```
200200

@@ -204,7 +204,7 @@ Let's look how to declare a delegate in Typescript by setting one for the [Tesse
204204
interface G8TesseractDelegate extends NSObjectProtocol {
205205
preprocessedImageForTesseractSourceImage?(
206206
tesseract: G8Tesseract,
207-
sourceImage: UIImage
207+
sourceImage: UIImage,
208208
): UIImage
209209
progressImageRecognitionForTesseract?(tesseract: G8Tesseract): void
210210
shouldCancelImageRecognitionForTesseract?(tesseract: G8Tesseract): boolean
@@ -226,7 +226,7 @@ class G8TesseractDelegateImpl extends NSObject implements G8TesseractDelegate {
226226

227227
preprocessedImageForTesseractSourceImage(
228228
tesseract: G8Tesseract,
229-
sourceImage: UIImage
229+
sourceImage: UIImage,
230230
): UIImage {
231231
console.info('preprocessedImageForTesseractSourceImage')
232232
return sourceImage

0 commit comments

Comments
 (0)