Re: [ServiceWorker] Cancelling HTTP fetch (#592)

Yeah, I think a controller type thing will work well. We can later explain it in terms of promise cancellation + stream cancellation.

A promise subclass would be confusing since `fetchPromise.cancel()` (or abort?) would probably have different semantics than `genericCancelablePromise.cancel()`, since e.g. the latter would not be able to affect anything after `genericCancelablePromise` settles.

> ```js
> var c = new FetchController,
> resp = fetch(url, { controller: c })
> c.abort()
> ```

This is pretty reasonable. Not sure whether I like it more or less than @tyoshino's equivalent:

```js
resp = fetch(url, { control(controller) {
  goElsewhereButton.addEventListener("click", () => controller.abort());
} });
```

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

Received on Thursday, 19 March 2015 10:22:35 UTC