- From: Ben Kelly <notifications@github.com>
- Date: Mon, 16 Feb 2015 05:33:05 -0800
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Monday, 16 February 2015 13:33:34 UTC
>From my thoughts on IRC the other day:
I personally think Request is an awkward place to put stateful information and mutating methods like this. These only really apply if you've passed the Request ro `fetch()`, but we are using Request for other APIs like Cache. Also, it makes `clone()` kind of a footgun since you should in theory lose the stateful extras when that is called.
It would really be nice to have some kind of object representing the in-progress fetch operation. It seems we don't have a good way to return this from `fetch()` directly, though.
The registry approach seems like it might be ok.
Or maybe we could have `fetch()` callback with a control object. Something like:
```
function onFetchStart(fetchControl) {
fetchControl.abort();
}
fetch('/my/url.html', { onstart: onFetchStart }).then(function (response) {
// normal stuff
});
```
Just not very promise-like, though.
---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/625#issuecomment-74508482
Received on Monday, 16 February 2015 13:33:34 UTC