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

19 lines
335 B

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