kv-netflix/frontend/scripts/haptics.js
2025-12-24 10:50:25 +07:00

34 lines
747 B
JavaScript

import { Haptics, ImpactStyle } from '@capacitor/haptics';
/**
* Trigger a light haptic feedback for small interactions
*/
export const hapticLight = async () => {
try {
await Haptics.impact({ style: ImpactStyle.Light });
} catch (e) {
// Fail silently if not on native
}
};
/**
* Trigger a medium haptic feedback for major interactions
*/
export const hapticMedium = async () => {
try {
await Haptics.impact({ style: ImpactStyle.Medium });
} catch (e) {
// Fail silently
}
};
/**
* Trigger a success haptic feedback
*/
export const hapticSuccess = async () => {
try {
await Haptics.notification({ type: 'SUCCESS' });
} catch (e) {
// Fail silently
}
};