2023-02-24 14:38:15 +00:00

34 lines
918 B
JavaScript
Executable File

import { Haptics, ImpactStyle } from "@capacitor/haptics"
export default {
selectionStart: async () => {
const enabled = window.app.cores.settings.get("haptic_feedback")
if (enabled) {
await Haptics.selectionStart()
}
},
selectionChanged: async () => {
const enabled = window.app.cores.settings.get("haptic_feedback")
if (enabled) {
await Haptics.selectionChanged()
}
},
selectionEnd: async () => {
const enabled = window.app.cores.settings.get("haptic_feedback")
if (enabled) {
await Haptics.selectionEnd()
}
},
impact: async (style = "Medium") => {
const enabled = window.app.cores.settings.get("haptic_feedback")
if (enabled) {
style = String(style).toTitleCase()
await Haptics.impact({ style: ImpactStyle[style] })
}
}
}