TapticKitClass exported from taptickit. Implements vibration via navigator.vibrate when supported, with optional DOM + audio fallback for development.
new TapticKit(options?: TapticKitOptions)
TapticKitOptions: debug?, showSwitch?.
| Name | Type | Description |
|---|---|---|
isSupported | boolean | true when navigator.vibrate is a function |
trigger(input?, options?)trigger(
input?: HapticInput,
options?: TriggerOptions,
): Promise<void>
Plays a pattern derived from input:
[{ duration: 25, intensity: 0.7 }]defaultPatterns (e.g. "success")[on, off, on, …] numbers or Vibration objects{ pattern: Vibration[] } preset shapeTriggerOptions: intensity? (0–1) scales default intensity per segment when individual vibrations omit intensity.
Durations are clamped to a safe window for the Vibration API. Invalid values log a warning and no-op.
cancel()Stops the internal animation loop and calls navigator.vibrate(0) when supported.
destroy()Tears down DOM nodes (accessibility label / switch) and closes any AudioContext opened for debug.
setDebug(debug: boolean)Enables or disables debug mode; disposes audio when turning off.
setShowSwitch(show: boolean)Shows or hides the injected switch UI.