The readme file can be formatted however you'd like. Just insert the docgen placeholder elements where the index of the API methods, and the API docs should go.
Below is an index of all the methods available.
impact(...)
notification(...)
vibrate(...)
addListener('vibrate', ...)
removeAllListeners()
- Interfaces
- Type Aliases
- Enums
Manage your readme content however, and on every docgen
rebuild
it will leave the original content as is, but update the inner text
of the docgen placeholder elements with the updated generated docs.
This content is from the JSDOC comments on top of
the HapticsPlugin
interface. All the API data below
is generated from comments from its methods, interfaces
and enums.
Take a look at the test HapticsPlugin interface source file.
impact(options: HapticsImpactOptions, x?: number | undefined) => Promise<HapticsImpact>
Trigger a haptics "impact" feedback
Param | Type | Description |
---|---|---|
options |
HapticsImpactOptions |
The impact options |
x |
number |
Returns: Promise<HapticsImpact>
Since: 1.0.0
notification(options?: HapticsNotificationOptions | undefined) => Promise<string | number>
Trigger a haptics "notification" feedback
Param | Type |
---|---|
options |
HapticsNotificationOptions |
Returns: Promise<string | number>
Since: 1.0.0
vibrate(options?: VibrateOptions | undefined) => Promise<number>
Vibrate the device
Param | Type |
---|---|
options |
VibrateOptions |
Returns: Promise<number>
Since: 1.0.0
addListener(eventName: 'vibrate', listenerFunc: VibrateListener) => Promise<void>
Add a listener. Callback has VibrateOptions.
Param | Type |
---|---|
eventName |
'vibrate' |
listenerFunc |
VibrateListener |
Since: 1.0.0
removeAllListeners() => void
Remove all the listeners that are attached to this plugin
Since: 1.0.0
Prop | Type |
---|---|
value |
number |
Prop | Type | Description | Default | Since |
---|---|---|---|---|
style |
HapticsImpactStyle |
Impact Feedback Style The mass of the objects in the collision simulated by a UIImpactFeedbackGenerator object. Type is a HapticsImpactStyle . |
HapticsImpactStyle.Heavy |
1.0.0 |
value |
boolean |
|||
recursive |
HapticsImpactOptions |
Prop | Type | Description | Default | Since |
---|---|---|---|---|
type |
HapticsNotificationType |
Notification Feedback Type The type of notification feedback generated by a UINotificationFeedbackGenerator object. |
HapticsNotificationType.SUCCESS |
1.0.0 |
Prop | Type | Description | Default | Since |
---|---|---|---|---|
duration |
number |
Duration of the vibration in milliseconds. Not supported in iOS. | 300 |
1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
style |
HapticsImpactStyle |
The style of vibration. | 1.0.0 |
duration |
number |
The duration of the vibration. | 1.0.0 |
repeat |
RepeatSchedule |
How often this vibrate event is repeated. | 1.0.0 |
The vibrate listener callback function.
(event: VibrateListenerEvent): void
How often a vibration repeats.
'hourly' | 'daily' | 'weekly' | 'monthly'
Members | Value | Description | Since |
---|---|---|---|
Heavy |
'HEAVY' |
A collision between small, light user interface elements | 1.0.0 |
Medium |
'MEDIUM' |
A collision between moderately sized user interface elements | 1.0.0 |
Light |
'LIGHT' |
A collision between small, light user interface elements | 1.0.0 |
Members | Value | Description | Since |
---|---|---|---|
SUCCESS |
'SUCCESS' |
A notification feedback type indicating that a task has completed successfully | 1.0.0 |
WARNING |
'WARNING' |
A notification feedback type indicating that a task has produced a warning | 1.0.0 |
ERROR |
'ERROR' |
A notification feedback type indicating that a task has failed | 1.0.0 |
Haptics can be configured with this options:
Prop | Type | Description | Default | Since |
---|---|---|---|---|
style |
'none' | 'native' |
Configure the style. | native |
1.0.0 |
duration |
number |
Configure the duration. | 1.2.3 |
In capacitor.config.json
:
{
"plugins": {
"Haptics": {
"style": "native",
"duration": 123
}
}
}
In capacitor.config.ts
:
/// <reference types="@capacitor/haptics" />
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
Haptics: {
style: "native",
duration: 123,
},
},
};
export default config;
The benefit of this readme file is that is also acts as the landing page for the Github repo and NPM package, and the anchors within the docs can also be linked to and shared.