partey_workadventure/front/src/Stores/SoundPlayingStore.ts

23 lines
456 B
TypeScript
Raw Normal View History

2021-06-02 16:46:28 +02:00
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();