Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capacitor/haptics

Package Overview
Dependencies
Maintainers
7
Versions
605
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/haptics

The Haptics API provides physical feedback to the user through touch or vibration.

  • 5.0.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created

What is @capacitor/haptics?

@capacitor/haptics is a Capacitor plugin that provides haptic feedback functionality for mobile applications. It allows developers to trigger various types of haptic feedback, such as vibrations and impact feedback, to enhance the user experience.

What are @capacitor/haptics's main functionalities?

Impact Feedback

This feature allows you to trigger an impact feedback with different styles such as light, medium, and heavy. The code sample demonstrates how to trigger a heavy impact feedback.

import { Haptics, ImpactStyle } from '@capacitor/haptics';

async function triggerImpact() {
  await Haptics.impact({ style: ImpactStyle.Heavy });
}

triggerImpact();

Notification Feedback

This feature allows you to trigger notification feedback with different types such as success, warning, and error. The code sample demonstrates how to trigger a success notification feedback.

import { Haptics, NotificationType } from '@capacitor/haptics';

async function triggerNotification() {
  await Haptics.notification({ type: NotificationType.SUCCESS });
}

triggerNotification();

Vibration

This feature allows you to trigger a simple vibration. The code sample demonstrates how to trigger a basic vibration feedback.

import { Haptics } from '@capacitor/haptics';

async function triggerVibration() {
  await Haptics.vibrate();
}

triggerVibration();

Selection Feedback

This feature allows you to provide feedback for selection changes. The code sample demonstrates how to trigger selection start, change, and end feedback.

import { Haptics } from '@capacitor/haptics';

async function triggerSelection() {
  await Haptics.selectionStart();
  // Perform some selection action
  await Haptics.selectionChanged();
  // Perform some selection action
  await Haptics.selectionEnd();
}

triggerSelection();

Other packages similar to @capacitor/haptics

Keywords

FAQs

Package last updated on 12 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc