You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/event-handler-custom-node-c.../main.html

26 lines
407 B

<button on:tap='set({ z: z + 1 })'>{{z}}</button>
<script>
export default {
data: () => ({
z: 10
}),
events: {
tap ( node, callback ) {
const clickHandler = event => {
callback(event);
};
node.addEventListener( 'click', clickHandler, false );
return {
teardown () {
node.addEventListener( 'click', clickHandler, false );
}
};
}
}
};
</script>