Merge pull request #2578 from EmilTholin/patch-1

Site: Document how to remove a component.$on listener
pull/2587/head
Rich Harris 5 years ago committed by GitHub
commit 85bf5bde8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -573,10 +573,14 @@ component.$on(event, callback)
Causes the `callback` function to be called whenever the component dispatches an `event`.
A function is returned that will remove the event listener when called.
```js
app.$on('selected', event => {
const off = app.$on('selected', event => {
console.log(event.detail.selection);
});
off();
```
#### `$destroy`

Loading…
Cancel
Save