Re: [ServiceWorker] Returning a FetchPromise from fetch() (#625)

I'm agree for cancelable promise. because when Promsie.race([a, b]) and rejects a first, I wanna cancel b at that time.
but that is not this topic.

FetchPromise seems only for fetch. and will you add new feature to Promise when we will get new capability on fetching process ?
I'm wander why you wanna extend Promise ?
I think it's better to stay Promise as generic for asynchronous processing. not adding API specific feature.

and also, how we can extend fetching process ?
extend Fetch class is clear and meaningful isn't it ?

for example. (also adding progress, abort, timeout too)

```
// Request / Response is only a data container
 
class Fetch {
  fetch() {
  }
  abort() {
  }
}
 
let fetch = new Fetch({ timeout: 3000 });
fetch
  .fetch(new Request()) // fetch.fetch()... more good name required.
  .then((res) => {
    console.log(res);
  })
  .catch(console.error);

fetch.addEventListener('progress', console.log);
 
setTimeout(() => {
  fetch.abort();
});

class MyFetch extend Fetch {
  someExtensibleWeb() {
  }
}
```

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/625#issuecomment-76162328

Received on Thursday, 26 February 2015 11:24:26 UTC