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/await-conservative-update/main.svelte

19 lines
292 B

<script>
import { sleep } from './sleep.js';
let count = 0;
const get_promise = () => {
return sleep(10).then(() => {
count += 1;
return 42;
});
};
</script>
{#await get_promise()}
<p>loading...</p>
{:then value}
<p>the answer is {value}</p>
<p>count: {count}</p>
{/await}