Browse Source

enh: notification sound

Timothy Jaeryang Baek 4 months ago
parent
commit
b70a31f81e
2 changed files with 6 additions and 1 deletions
  1. 6 1
      src/lib/components/NotificationToast.svelte
  2. BIN
      static/audio/notification.mp3

+ 6 - 1
src/lib/components/NotificationToast.svelte

@@ -2,13 +2,18 @@
 	import DOMPurify from 'dompurify';
 
 	import { marked } from 'marked';
-	import { createEventDispatcher } from 'svelte';
+	import { createEventDispatcher, onMount } from 'svelte';
 
 	const dispatch = createEventDispatcher();
 
 	export let onClick: Function = () => {};
 	export let title: string = 'HI';
 	export let content: string;
+
+	onMount(() => {
+		const audio = new Audio(`/audio/notification.mp3`);
+		audio.play();
+	});
 </script>
 
 <button

BIN
static/audio/notification.mp3