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
292 B
19 lines
292 B
5 years ago
|
<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}
|