The video uses a specific AI coding tool to demonstrate the setup, but the configuration works 1:1 with Cursor, Claude Code, or any other tool. Despia is web framework and tooling agnostic, so the only thing that matters is the SDK call.
Installation
- Bundle
- CDN
How it works
Each scheme is fire-and-forget. The native runtime triggers the haptic immediately, your JavaScript keeps running. There are no parameters and no return value.isDespia guard, so the same code is safe to run during web preview.
The five haptic patterns
Match the pattern to user intent rather than trying to engineer custom intensity through repeated calls. iOS users in particular are conditioned by system apps to read these patterns as signals (the success/warning/error trio matches Apple’s UINotificationFeedbackGenerator), so reusing them keeps your app feeling native.
Wire haptics to user actions
Calldespia('...haptic://') directly at the call site. No helper, no wrapper, no abstraction. The scheme is already short and reads clearly.
useEffect reactions to derived state, since renders can fire faster than the user perceives, leading to phantom buzzing.
Game and confirmation patterns
Haptics work well in two places where regular web apps cannot reach: game-style feedback loops and confirmation dialogs. Both rely on the user feeling the result rather than reading it.Resources
NPM Package
despia-native