partey_workadventure/front/src/Stores/SoundPlayingStore.ts
2021-09-06 14:31:59 +02:00

21 lines
457 B
TypeScript

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();