Skip to content

Commit 394a166

Browse files
ematipicoConduitry
authored andcommitted
docs: multiple event listeners on single node (#2825)
1 parent 1e91911 commit 394a166

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

site/content/docs/02-template-syntax.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,24 @@ If the `on:` directive is used without a value, the component will *forward* the
351351
</button>
352352
```
353353

354+
---
355+
356+
It's possible to have multiple event listeners for the same event:
357+
358+
```html
359+
<script>
360+
let counter = 0;
361+
function increment() {
362+
counter = counter + 1;
363+
}
364+
365+
function track(event) {
366+
trackEvent(event)
367+
}
368+
</script>
369+
370+
<button on:click={increment} on:click={track}>Click me!</button>
371+
```
354372

355373
### Component events
356374

0 commit comments

Comments
 (0)