Anything exported from a context="module" script block becomes an export from the module itself. If we export a stopAll function from AudioPlayer.svelte...

<script context="module">
	const elements = new Set();

	export function stopAll() {
		elements.forEach(element => {

...we can then import it from App.svelte...

	import AudioPlayer, { stopAll } from './AudioPlayer.svelte';

...and use it in an event handler:

<button on:click={stopAll}>
	stop all audio

You can't have a default export, because the component is the default export.

loading editor...
loading Svelte compiler...

loading editor...

Compiler options

result = svelte.compile(source, {

loading editor...