added haptics core

This commit is contained in:
SrGooglo 2023-06-13 22:51:53 +00:00
parent 35bda8c947
commit 3d3ebdff15

View File

@ -0,0 +1,28 @@
import Core from "evite/src/core"
export default class HapticsCore extends Core {
static refName = "haptics"
static namespace = "haptics"
static dependencies = [
"settings"
]
static get isGlobalDisabled() {
return app.cores.settings.get("haptic_feedback")
}
public = {
isGlobalDisabled: HapticsCore.isGlobalDisabled,
vibration: this.vibration.bind(this),
}
vibration(...args) {
const disabled = this.isGlobalDisabled
if (disabled) {
return false
}
return navigator.vibrate(...args)
}
}