Skip to content

Commit

Permalink
fix(timer): stop sound on query change, bad code tho
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksasiriski committed Jul 13, 2024
1 parent c9201dc commit 365f604
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/gadgets/timer/beeper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
/** @type {Props} */
let { beeping = $bindable(), beepingInterval = $bindable() } = $props();
let { beeping, beepingInterval = $bindable() } = $props();
/**
* Get the frequency of a note.
Expand Down
8 changes: 7 additions & 1 deletion src/lib/components/gadgets/timer/main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
let beeping = $state(false);
/** @type {number|undefined} */
let beepingInterval = $state(undefined);
$effect(() => {
// Dummy IF to trigger the effect.
if (query) {
}
clearInterval(beepingInterval);
});
/** @type {HTMLElement | null} */
let timerNumbersContainer = $state(null);
Expand Down Expand Up @@ -156,7 +162,7 @@
}}
/>

<Beeper bind:beeping bind:beepingInterval />
<Beeper {beeping} bind:beepingInterval />

<div class="mx-auto max-w-screen-sm">
<div class="mx-2 mt-2 border-2 border-neutral-200 dark:border-neutral-600 rounded-xl">
Expand Down

0 comments on commit 365f604

Please sign in to comment.