npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

web-haptic-engine

v1.0.3

Published

Cross-platform (iOS and Android) haptic feedback engine for the web

Downloads

313

Readme


✨ Features

| Category | Details | | -------------------------- | ------------------------------------------------------------------------------------------------------- | | 📱 Android Vibration | Full navigator.vibrate() pattern support with intensity-scaled durations | | 🍎 iOS Taptic | Exploits the <input type="checkbox" switch> toggle to trigger native Taptic Engine feedback | | 🔊 Audio Impulse Layer | 8 synthesized AudioBuffer impulses (tick, tap, thud, click, snap, buzz, confirm, harsh) | | 👆 Drag Haptics | Touchmove-driven haptic feedback with distance threshold — works reliably on iOS | | 🎛️ 23 Presets | Ready-to-use patterns: success, warning, error, heartbeat, spring, buzz, and more | | 🔗 Sequences | Chain presets with delays, repeats, and custom gaps | | 〰️ Easing Functions | linear, easeIn, easeOut, easeInOut, bounce, spring | | 📦 Zero Dependencies | No external runtime dependencies — pure TypeScript |


📚 Documentation

Full documentation with framework integration guides is available at sumitsahoo.github.io/web-haptic-engine/docs.


📥 Installation

npm install web-haptic-engine
pnpm add web-haptic-engine
yarn add web-haptic-engine

🚀 Quick Start

import { haptic } from "web-haptic-engine";

await haptic("success");
await haptic("heavy", { intensity: 0.8 });

See the full documentation for engine setup, drag haptics, sequences, custom presets, and framework-specific guides.


🧑‍💻 Development

# Install dependencies
vp install

# Build the library
vp pack

# Run tests
vp test

# Watch mode (rebuild on changes)
vp pack --watch

# Start docs dev server
vp run docs:dev

# Build docs for production
vp run docs:build

🎮 Demo

Try the live demo at sumitsahoo.github.io/web-haptic-engine.

An interactive demo is also included in the demo/ directory. It showcases all 23 presets, drag haptics, impulse buffers, sequences, and real-time controls for intensity and audio gain.

# Install dependencies (if not already done)
vp install

# Start the demo dev server
vp run demo

This launches a Vite dev server. Open the URL shown in the terminal (typically http://localhost:5173) in your browser. For the full haptic experience, open it on a mobile device — Android for vibration, iOS Safari for Taptic feedback. On desktop, audio impulses still play as a fallback.


📁 Project Structure

web-haptic-engine/
├── src/
│   ├── core/               # Types, constants, easings & presets
│   ├── audio/              # Web Audio impulse synthesis & playback
│   ├── platform/           # Platform detection & adapters (Android, iOS)
│   ├── interactions/       # User interaction patterns (drag haptics)
│   ├── haptic-engine.ts    # Main HapticEngine class & convenience helpers
│   └── index.ts            # Public API exports
├── docs/                   # VitePress documentation site
│   ├── .vitepress/         # VitePress config & theme
│   ├── guide/              # Getting started, presets, platform support
│   ├── frameworks/         # React, Next.js, Vue integration guides
│   └── api/                # API reference (HapticEngine, DragHaptics, Types)
├── demo/
│   ├── index.html          # Demo page
│   ├── main.ts             # Demo app (imports from library)
│   └── vite.config.ts      # Vite config for demo dev server
├── tests/
│   └── index.test.ts       # Unit tests
├── tsdown.config.ts        # Library build config
├── vite.config.ts          # Vite+ unified config
├── tsconfig.json           # TypeScript config
└── package.json

💡 Acknowledgements

This project was initially inspired by web-haptics by @lochie.


🤝 Contributing

Contributions are welcome! Please see the CONTRIBUTING.md guide for details.


📄 License

This project is licensed under the MIT License — feel free to use it for both personal and commercial purposes. See the LICENSE file for details.