- From: Jake Archibald <notifications@github.com>
- Date: Mon, 30 Mar 2015 10:11:43 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
Received on Monday, 30 March 2015 17:12:07 UTC
Say you have a ServiceWorker with: ```js self.addEventListener('fetch', function(event) { event.respondWith( fetch('/whatever.json').then(function(response) { return response.json(); }).then(function(data) { return fetch(data.url); }) ); }); ``` Say this request is in progress and the user hits X in the browser UI, closes the tab, or navigates. The browser can cancel the stream once the promise it gets resolves, but it cannot abort either fetch or the `.json` read of the first fetch. A chaining cancellable promise solves this problem, as the browser calls cancel, and the currently in-progress part of the promise chain is terminated. Counter to some of the complaints in this thread, this is a case where you *do* want the receiver of the promise to have cancellation rights. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/27#issuecomment-87754126
Received on Monday, 30 March 2015 17:12:07 UTC