prepare sending image to server

This commit is contained in:
waltem01 2024-02-15 08:28:08 +01:00
parent 60fd19cb17
commit f9d2d9fd72

View File

@ -9,9 +9,7 @@
let imageURL: string, uploadData: UploadData;
async function sendImage(data: ImageData) {}
async function loadImage(url: string): Promise<ImageData> {}
async function sendImage() {}
function uploadImage(event: Event) {
// Revoke previous image url, if any
@ -30,17 +28,12 @@
<input type="file" name="image" accept="image/*" on:change={uploadImage} />
{#if imageURL}
<img src={imageURL} alt="User uploaded" />
{#await loadImage(imageURL)}
<p>Loading image data . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{:then data}
{#await sendImage(data)}
<p>Uploading image data . . .</p>
{#await sendImage()}
<p>Sending image . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{:then}
<p>Done!</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{clearInterval(uploadData.interval)}
{/await}
{/await}
{/if}