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/action-ternary-template/main.html

21 lines
343 B

<h1 use:insert="display ? `Hello ${target}` : ''"></h1>
<script>
export default {
actions: {
insert(node, text) {
function onClick() {
node.textContent = text;
}
node.addEventListener('click', onClick);
return {
destroy() {
node.removeEventListener('click', onClick);
}
}
}
}
}
</script>