prepare image upload steps

This commit is contained in:
waltem01 2024-02-15 08:13:44 +01:00
parent d75b74965b
commit 664c58e863

View File

@ -9,7 +9,9 @@
let imageURL: string, uploadData: UploadData; let imageURL: string, uploadData: UploadData;
async function loadImage(url: string) {} async function sendImage(data: ImageData) {}
async function loadImage(url: string): Promise<ImageData> {}
function uploadImage(event: Event) {} function uploadImage(event: Event) {}
</script> </script>
@ -18,11 +20,16 @@
{#if imageURL} {#if imageURL}
<img src={imageURL} alt="User uploaded" /> <img src={imageURL} alt="User uploaded" />
{#await loadImage(imageURL)} {#await loadImage(imageURL)}
<p>Loading image . . .</p> <p>Loading image data . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p> <p>{uploadData.elapsed} seconds elapsed.</p>
{:then imageData} {:then data}
{#await sendImage(data)}
<p>Uploading image data . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{:then}
<p>Done!</p> <p>Done!</p>
<p>{uploadData.elapsed} seconds elapsed.</p> <p>{uploadData.elapsed} seconds elapsed.</p>
{clearInterval(uploadData.interval)} {clearInterval(uploadData.interval)}
{/await} {/await}
{/await}
{/if} {/if}