Document how to remove a component.$on listener

This PR documents how `component.$on` returns a function that removes the event listener when called.
pull/2578/head
Emil Tholin 5 years ago committed by GitHub
parent cc4e5b3e31
commit eab763c386
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