You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/haptics/README.md
+15-5
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,17 @@
1
1
# @nativescript/haptics
2
2
3
+
A plugin that allows you to add haptics to your app.
4
+
3
5
> Playing haptics can engage people's sense of touch and bring their familiarity with the physical world into your app or game.
4
6
~ Developer docs
5
7
6
8
7
9
Thanks to [Eddy Verbruggen](EddyVerbruggen) for providing [nativescript-taptic-engine](https://github.com/EddyVerbruggen/nativescript-taptic-engine) as this continues its evolution by streamlining the API and adding Android support, inspired by [react-native-haptic-feedback](https://github.com/junina-de/react-native-haptic-feedback).
@@ -26,13 +30,19 @@ Thanks to [Eddy Verbruggen](EddyVerbruggen) for providing [nativescript-taptic-e
26
30
npm install @nativescript/haptics
27
31
```
28
32
33
+
## Use @nativescript/haptics
34
+
35
+
Find an example of `@nativescript/haptics` usage [here](https://stackblitz.com/edit/nativescript-stackblitz-templates-jlvtwm?file=app/main-view-model.ts) on StackBlitz.
36
+
29
37
## API
30
38
39
+
The plugin provides the API below.
40
+
31
41
### isSupported()
32
42
```ts
33
43
isHapticsSupported: boolean=Haptics.isSupported()
34
44
```
35
-
Checks if Haptics is supported.
45
+
Checks if haptics is supported on the device.
36
46
37
47
---
38
48
### is6SAnd6SPlusSupported()
@@ -84,7 +94,7 @@ There are 3 impact types:
84
94
85
95
### HapticsFallback
86
96
87
-
To use the haptics fallbacks, first check if there is support:
97
+
To use the haptics fallbacks, check if there is support:
88
98
89
99
```ts
90
100
if (!Haptics.isSupported() &&Haptics.is6SAnd6SPlusSupported()) {
@@ -110,15 +120,15 @@ import { HapticsFallback } from "@nativescript/haptics";
110
120
111
121
HapticsFallback.strongBoom();
112
122
```
113
-
This triggers the 'Pop' effect of 'Peek & Pop', which is a bit more profound than the 'Peek' effect.
123
+
This triggers the `Pop` effect of `Peek & Pop`, which is a bit more profound than the `Peek` effect.
0 commit comments