3 changed files with 19 additions and 0 deletions
Binary file not shown.
@ -0,0 +1,17 @@ |
|||
import { useAppStore } from '@core/stores/appStore.js'; |
|||
|
|||
const notificationSound = new Audio("/notification.mp3"); |
|||
|
|||
let isPlaying = false; |
|||
|
|||
export const playNotificationSound = () => { |
|||
const { notifications } = useAppStore.getState(); |
|||
if (notifications && !isPlaying) { |
|||
isPlaying = true; |
|||
notificationSound.play(); |
|||
|
|||
notificationSound.onended = () => { |
|||
isPlaying = false; |
|||
}; |
|||
} |
|||
}; |
|||
Loading…
Reference in new issue