vue-haptics
v2.0.2
Published
A convenient Vue composable to trigger haptic feedback anywhere in your application
Maintainers
Readme
vue-haptics
A convenient Vue composable to trigger haptic feedback anywhere in your application
Overview
This package utilizes the input[switch] element introduced in
Safari 18.0 to
trigger haptic feedback anytime, anywhere in your Vue application.
Features
- Trigger haptic feedback at any time in your Vue application
- Support iOS, Android
- Simple, intuitive API
- Native TypeScript support
- ESM / CJS compatible
Installation
npm install vue-hapticsyarn add vue-hapticspnpm add vue-hapticsbun add vue-hapticsUsage
<script setup lang="ts">
import { useHaptic } from "vue-haptics";
const { triggerHaptic } = useHaptic();
</script>
<template>
<button @click="triggerHaptic">Feel Haptic</button>
</template>Quick Start
Clone the repository and run the sample app:
git clone https://github.com/osaxyz/vue-haptics.git
cd sample/vite-vue
npm install
npm run devYou can visit the demo page by scanning the QR code displayed in the terminal.
Development
# Install dependencies
npm install
# Run tests
npm test
# Build
npm run buildPublishing to npm
npm run build
npm publish --access public