Skip to content

Instantly share code, notes, and snippets.

@asadmalik
Created May 23, 2024 13:19
Show Gist options
  • Save asadmalik/514ec65dc854d9e49f22d82089e541ed to your computer and use it in GitHub Desktop.
Save asadmalik/514ec65dc854d9e49f22d82089e541ed to your computer and use it in GitHub Desktop.
<script setup>
import { useVibrate } from "@vueuse/core";
// This vibrates the device for 300 ms
// then pauses for 100 ms before vibrating the device again for another 300 ms:
const { vibrate, stop, isSupported } = useVibrate({ pattern: [300, 100, 300] });
// Start the vibration, it will automatically stop when the pattern is complete:
vibrate();
// But if you want to stop it, you can:
stop();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment