Updated documentation for eventlisteners

pull/378/head
kay999 7 years ago committed by GitHub
parent b9f2db2e60
commit efda964ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -454,6 +454,14 @@ h('div', [
]);
```
Each handler is called not only with the given arguments but also with the current event and vnode appended to the argument list. It also supports using multiple listeners per event by specifying an array of handlers:
```javascript
stopPropagation = function(ev) { ev.stopPropagation() }
sendValue = function(func, ev, vnode) { func(vnode.elm.value) }
h('a', { on:{ click:[[sendValue, console.log], stopPropagation] } });
```
Snabbdom allows swapping event handlers between renders. This happens without
actually touching the event handlers attached to the DOM.

Loading…
Cancel
Save