mirror of https://github.com/sveltejs/svelte
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.
19 lines
335 B
19 lines
335 B
6 years ago
|
<script>
|
||
6 years ago
|
export let display;
|
||
|
export let target;
|
||
6 years ago
|
|
||
6 years ago
|
function insert(node, text) {
|
||
|
function onClick() {
|
||
|
node.textContent = text;
|
||
|
}
|
||
|
node.addEventListener('click', onClick);
|
||
6 years ago
|
|
||
6 years ago
|
return {
|
||
|
destroy() {
|
||
|
node.removeEventListener('click', onClick);
|
||
6 years ago
|
}
|
||
|
}
|
||
|
}
|
||
6 years ago
|
</script>
|
||
|
|
||
|
<h1 use:insert="{display ? `Hello ${target}` : ''}"></h1>
|