- From: Domenic Denicola <notifications@github.com>
- Date: Thu, 19 Mar 2015 03:22:06 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Thursday, 19 March 2015 10:22:35 UTC
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