| const beepSoundFile = new URL("../assets/beep.mp3", import.meta.url).href; | |
| const beepSound = new Audio(beepSoundFile); | |
| export function useBeep() { | |
| let beepInterval: ReturnType<typeof setInterval> | null = null; | |
| function startBeeping() { | |
| beepSound.play(); | |
| beepInterval = setInterval(() => { | |
| beepSound.play(); | |
| }, 3000); | |
| } | |
| function stopBeeping() { | |
| if (beepInterval) { | |
| clearInterval(beepInterval); | |
| } | |
| } | |
| return { startBeeping, stopBeeping }; | |
| } | |