Haptics
Provides static methods to interact with the device's vibration functionality via the Vibration API.
static isSupported(): boolean
Checks if the Vibration API is supported by the browser.
Example:
if (Haptics.isSupported()) {
console.log('Vibration API supported');
}
static vibrate(pattern: number | number[]): void
Defines the vibration pattern. It can be a single duration in milliseconds or an array of durations where each number represents a vibration duration followed by a pause.
Example:
Haptics.vibrate(200); // Vibrates for 200ms
Haptics.vibrate([100, 50, 100]); // Vibrates, pauses, vibrates
static cancel(): void
Stops any ongoing vibration.
Example:
Haptics.cancel();