pull/11912/head
Dominic Gannaway 2 years ago
parent f170e00399
commit d45bc778f1

@ -123,6 +123,8 @@ imperatively doing `element.addEventListener`, with that benefit that `attach` w
```js ```js
import { attach } from 'svelte/events'; import { attach } from 'svelte/events';
let element;
attach(element, 'click', () => { attach(element, 'click', () => {
console.log('click the element!'); console.log('click the element!');
}); });
@ -133,6 +135,8 @@ Additionally, `attach` returns a function that easily allows for removal of the
```js ```js
import { attach } from 'svelte/events'; import { attach } from 'svelte/events';
let element;
const remove = attach(element, 'click', () => { const remove = attach(element, 'click', () => {
console.log('click the element!'); console.log('click the element!');
}); });

Loading…
Cancel
Save