mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
added haptics core
This commit is contained in:
parent
35bda8c947
commit
3d3ebdff15
28
packages/app/src/cores/haptics/haptics.core.js
Normal file
28
packages/app/src/cores/haptics/haptics.core.js
Normal 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)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user