Event forwarding works for DOM events too.
We want to get notified of clicks on our <BigRedButton> — to do that, we just need to forward click events on the <button> element in BigRedButton.svelte:
<BigRedButton>
click
<button>
BigRedButton.svelte
<button on:click> Push </button>
Next: Bindings
<script>
import BigRedButton from './BigRedButton.svelte';
import horn from './horn.mp3';
const audio = new Audio();
audio.src = horn;
function handleClick() {
audio.play();
}
</script>
<BigRedButton on:click={handleClick} />