diff options
Diffstat (limited to 'packages/frontend/src/lib/components/HotReloadIndicator.svelte')
| -rw-r--r-- | packages/frontend/src/lib/components/HotReloadIndicator.svelte | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/frontend/src/lib/components/HotReloadIndicator.svelte b/packages/frontend/src/lib/components/HotReloadIndicator.svelte index 3e34d3b..8d37578 100644 --- a/packages/frontend/src/lib/components/HotReloadIndicator.svelte +++ b/packages/frontend/src/lib/components/HotReloadIndicator.svelte @@ -1,26 +1,26 @@ <script lang="ts"> - const { active }: { active: boolean } = $props(); +const { active }: { active: boolean } = $props(); - let visible = $state(false); - let timer: ReturnType<typeof setTimeout> | null = null; +let visible = $state(false); +let timer: ReturnType<typeof setTimeout> | null = null; - $effect(() => { - if (active) { - visible = true; - if (timer !== null) clearTimeout(timer); - timer = setTimeout(() => { - visible = false; - timer = null; - }, 2000); - } - return () => { - if (timer !== null) { - clearTimeout(timer); - timer = null; - } +$effect(() => { + if (active) { + visible = true; + if (timer !== null) clearTimeout(timer); + timer = setTimeout(() => { visible = false; - }; - }); + timer = null; + }, 2000); + } + return () => { + if (timer !== null) { + clearTimeout(timer); + timer = null; + } + visible = false; + }; +}); </script> {#if visible} |
