23 lines
456 B
TypeScript
23 lines
456 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();
|