fix: pop sound not saved and played when marking tasks done
This commit is contained in:
parent
553fd54f78
commit
c06cc6ad7a
3 changed files with 13 additions and 8 deletions
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue