Haptic feedback for the mobile web in vanilla JS.
Adopted from web-haptics by lochie.
Same API but without a build step or Typescript, so you can throw it into any webapp.
<script type="module">
import { createHaptics } from "./web-haptics-js.min.js";
const { trigger } = createHaptics();
document.querySelector("button").addEventListener("click", () => {
trigger("medium");
});
</script>Direct link to the minified version: https://cdn.jsdelivr.net/gh/seanockert/web-haptics-js@1.0.0/web-haptics-js.min.js
Use the prebuilt patterns eg. trigger('success') or design your own eg. trigger([{ duration: 10 }], { intensity: 1 })
See the original library website for more details