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.
24 lines
458 B
24 lines
458 B
6 years ago
|
<script>
|
||
6 years ago
|
import { tick } from 'svelte';
|
||
6 years ago
|
|
||
|
export let snapshots = [];
|
||
|
|
||
|
let count = 0;
|
||
|
let buttons = [];
|
||
|
|
||
|
function increment() {
|
||
|
count += 1;
|
||
|
log();
|
||
|
}
|
||
|
|
||
|
function log() {
|
||
|
snapshots.push(`before ${buttons[0].textContent}`);
|
||
|
|
||
6 years ago
|
tick().then(() => {
|
||
6 years ago
|
snapshots.push(`after ${buttons[0].textContent}`);
|
||
|
});
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<button bind:this={buttons[0]} on:click={increment}>{count}</button>
|
||
|
<button bind:this={buttons[1]} on:click={log}>{count}</button>
|