Re: [whatwg/fetch] upload progress? (#21)

> The native `fetch()` API implemented by browsers does not use XMLHttpRequest underneath.

But yet, it does not mean it couldn't be pondered and proposed.

Native promises are not yet cancellable and/or progressed, so my proposal would be for a callback on the second argument object of `fetch` which would receive a `ProgressEvent` (which is already present because of XHR).

As a polyfill, it could be easily placed with the `progress` event listener as stated by the OP.


API Example: 
```js
aync fetchSometing ( form ) {
  const res = await fetch('/upload', {
    method: 'POST',
    body: form,
    progress: (e) => { console.log(`Progress: ${e.loaded/e.total}%`) }
  })
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/21#issuecomment-290351717

Received on Thursday, 30 March 2017 09:17:50 UTC