You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
406 B
17 lines
406 B
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;
|
|
};
|
|
}
|
|
};
|
|
|