Forward all events
npm install svelte-on-anySvelte on any is a tiny preprocessor which helps to forward all DOM events.
yarn add svelte-on-any
`In your
rollup.config.js add onAny to preprocess section:`
import onAny from "svelte-on-any";
svelte({
preprocess: {
...onAny(),
}
})
`Now all you have to do is put
on:any on your element!
`
`
Will generate
`
`$3
On-any accepts one argument which is a function called on the list of events.
`
// Forward only events that contain "mouse" in their name
onAny(events => events.filter(event => event.includes('mouse')))
``Feedback and feature requests are welcome!