refac: play sound only in last active tab

This commit is contained in:
Timothy Jaeryang Baek committed 2025-01-04 02:30:51 -08:00
1 parent afcbf2cafb
commit f31e2af349
3 files changed
+43 -14

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { settings, playingNotificationSound } from '$lib/stores';
import { settings, playingNotificationSound, isLastActiveTab } from '$lib/stores';
import DOMPurify from 'dompurify';
import { marked } from 'marked';
@@ -17,7 +17,7 @@
}
if ($settings?.notificationSound ?? true) {
if (!$playingNotificationSound) {
if (!$playingNotificationSound && $isLastActiveTab) {
playingNotificationSound.set(true);
const audio = new Audio(`/audio/notification.mp3`);