1
0

fix: pop sound not saved and played when marking tasks done

This commit is contained in:
kolaente
2022-02-26 14:48:46 +01:00
parent 553fd54f78
commit c06cc6ad7a
3 changed files with 13 additions and 8 deletions

View File

@ -3,11 +3,15 @@ import popSoundFile from '@/assets/audio/pop.mp3'
export const playSoundWhenDoneKey = 'playSoundWhenTaskDone'
export function playPop() {
const enabled = Boolean(localStorage.getItem(playSoundWhenDoneKey))
if(!enabled) {
const enabled = localStorage.getItem(playSoundWhenDoneKey) === 'true'
if (!enabled) {
return
}
playPopSound()
}
export function playPopSound() {
const popSound = new Audio(popSoundFile)
popSound.play()
}
}