I am trying to make a Svelte app, where I have a class (not svelte component) that create an audioSource, and manage it.
I would like to get this class instance across multiple component.
Right now, the only way I found is to do this :
<script lang="ts" context="module">
import { AudioAnalyser } from "@app/class/audio/AudioAnalyser";
import type { MediaAnalyser } from "@app/types/analyser";
let analyser: MediaAnalyser = new AudioAnalyser();
</script>
Inside a component, so I am sure there is only one instance, and share that instance via property binding with other Component.
But I am trying to find a way where I could instantiate this class once and access it trought all the app like with an angular Service.
thank you