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-mount-and-unmount-imm.../main.svelte

36 lines
579 B

<script>
import { tick } from 'svelte';
import Component from './Component.svelte';
let promise;
let resolve;
let value = 0;
export let logs = [];
async function new_promise() {
promise = new Promise(r => {
resolve = r;
});
}
async function resolve_promise() {
await Promise.resolve();
resolve(value++);
}
export async function test() {
resolve_promise();
await Promise.resolve();
new_promise();
resolve_promise();
return tick();
}
new_promise();
</script>
{#await promise}
Loading...
{:then state}
<Component {state} {logs} />
{/await}