- From: Jake Archibald <notifications@github.com>
- Date: Thu, 19 Jan 2017 06:25:19 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 19 January 2017 14:25:51 UTC
>From recent discussion & proposals, it looks like the controller and observer should be separate.
```js
const controller = new FetchController();
fetch(url, {
controller,
observer(observer) {
// ...
}
});
```
In this model, a single controller could be used by multiple fetches. A controller could observe an observer:
```js
controller.observe(observer);
```
…meaning it aborts & changes priority along with what it observes.
The observer would be exposed to the service worker:
```js
addEventListener('fetch', event => {
const controller = new FetchController();
controller.observe(event.fetchObserver);
event.respondWith(
fetch(url, {controller})
);
});
```
--
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/447#issuecomment-273789078
Received on Thursday, 19 January 2017 14:25:51 UTC