UNPKG

use-haptic

Version:

A convenient React hook to trigger haptic feedback anywhere in your application

34 lines (33 loc) 1.25 kB
"use strict"; /** * use-haptic * * A React hook library that provides haptic feedback functionality for mobile web applications. * This library uses the `input[switch]` element for iOS devices and the Vibration API for other devices. * * @example * ```tsx * import { useHaptic } from "use-haptic"; * * function HapticButton() { * const { triggerHaptic } = useHaptic(); * return <button onClick={triggerHaptic}>Haptic</button>; * } * ``` */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./useHaptic.js"), exports);