ios-haptics
v0.1.4
Published
haptic feedback for ios safari
Maintainers
Readme
📳 ios-haptics
javascript library for haptic feedback inside of safari on ios
demo: ios-haptics demo
📦 installation
npm i ios-haptics🚀 usage
import { haptic } from 'ios-haptics'
// a single haptic
haptic()
// two rapid haptics
haptic.confirm()
// three rapid haptics
haptic.error()⚙️ how it works
this uses the <input type="checkbox" switch /> (introduced in safari 17.4), which has haptic feedback when toggled
every haptic call, it will create one of those in the background, toggle it, then remove it
on devices that support it, navigator.vibrate() is called instead, so it works on android too
feel free to send a pr or open an issue if you have suggestions or find improvements
