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/lifecycle-after-flush/main.html

19 lines
343 B

<script>
import { afterFlush } from 'svelte';
export let snapshots = [];
let count = 0;
let button;
function click() {
count += 1;
snapshots.push(`before ${button.textContent}`);
afterFlush(() => {
snapshots.push(`after ${button.textContent}`);
});
}
</script>
<button bind:this={button} on:click={click}>{count}</button>