WIP: feat: vibrate on marked as done #2665
|
@ -152,6 +152,8 @@ import {useNamespaceStore} from '@/stores/namespaces'
|
|||
import {useBaseStore} from '@/stores/base'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
|
||||
const VIBRATION_PATTERN_SUCCESS = [100]
|
||||
|
||||
const props = defineProps({
|
||||
theTask: {
|
||||
type: Object as PropType<ITask>,
|
||||
|
@ -244,6 +246,11 @@ async function markAsDone(checked: boolean) {
|
|||
}
|
||||
|
||||
if (checked) {
|
||||
// TODO: move to store, make configurable in user settings
|
||||
if (window.navigator?.vibrate) {
|
||||
// vibrate shortly to indicate success
|
||||
window.navigator.vibrate(VIBRATION_PATTERN_SUCCESS)
|
||||
}
|
||||
setTimeout(updateFunc, 300) // Delay it to show the animation when marking a task as done
|
||||
} else {
|
||||
await updateFunc() // Don't delay it when un-marking it as it doesn't have an animation the other way around
|
||||
|
|
Reference in New Issue
Block a user