Moving audio message to Svelte

This commit is contained in:
David Négrier 2021-06-02 16:46:28 +02:00
parent faa4c7c08e
commit 267d0a2cd1
11 changed files with 110 additions and 74 deletions

View file

@ -0,0 +1,22 @@
import { writable } from "svelte/store";
/**
* A store that contains the URL of the sound currently playing
*/
function createSoundPlayingStore() {
const { subscribe, set, update } = writable<string|null>(null);
return {
subscribe,
playSound: (url: string) => {
set(url);
},
soundEnded: () => {
set(null);
}
};
}
export const soundPlayingStore = createSoundPlayingStore();