Skip to content

tijnjh/ios-haptics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ios-haptics

javascript library for haptic feedback inside of safari on ios

GitHub last commit npm version NPM Downloads npm package minimized gzipped size

demo: ios-haptics demo

installation

npm i ios-haptics

usage

import { haptic } from 'ios-haptics'

// a single haptic
haptic()

// two rapid haptics (good for confirmation)
haptic.confirm()

// three rapid haptics (useful for errors)
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


Feel free to send a PR or open an issue if you have suggestions or find improvements.

About

A JavaScript utility for haptic feedback on iOS devices.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •