sveltekit-zero-api icon indicating copy to clipboard operation
sveltekit-zero-api copied to clipboard

[Feature Request] 2.0 - xhr, upload progress tracking

Open doolijb opened this issue 11 months ago • 7 comments

I haven't had a look at the PR for feedback yet, but my projects depend heavily on sveltekit-zero-api so I'll definitely dig into it within the coming weeks.

With that said, any thoughts on supporting xhr/upload progress events?

Example:

let progress = $state(0)

async function onprogress(e) {
  if (event.lengthComputable) {
    const percentComplete = (event.loaded / event.total) * 100
    progress = percentComplete
  }
}

async function onsubmit() {
  await api.videos.POST({ body, xhr: { upload: { onprogress } })...
}

doolijb avatar Nov 13 '24 21:11 doolijb