fn
useVibrate
v0.0.15testeddemoReactive wrapper around the `navigator.vibrate` Vibration API.
Examples
ts
const { vibrate, stop, isSupported } = useVibrate({ pattern: [200, 100, 200] });
vibrate();ts
// Loop a pattern on an interval
const { vibrate, stop, intervalControls } = useVibrate({ pattern: [300, 100], interval: 2000 });
intervalControls?.resume();Demo
Loading demo…
Signature
ts
export function useVibrate(options: UseVibrateOptions ={ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
options? | UseVibrateOptions | Configuration options |
Returns
UseVibrateReturnSupport flag, reactive pattern, vibrate/stop actions, and optional interval controls