- From: Andrea Giammarchi <notifications@github.com>
- Date: Mon, 01 Feb 2016 08:25:36 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/27/178055186@github.com>
@davidbonnet there are plenty of working examples, solutions, and use cases in this thread already. Keep being notified after a year with something already discussed almost daily made me come back to clarify that we all know how to fix this, it's just a matter of: "will it scale universally as solution? will it cover them all?" I wish these conversations were done upfront, and not after a standard ... yet I understand the bikeshedding would be close to impossible to handle. I honestly also think this should be closed because if in a year there's no solution it means there shouldn't be. Maybe in the future there will be a lightweight fresh new `request` API that simply wraps the `fetch` one but it doesn't exposes the `fetch` object itself directly so that everyone that didn't care 'till now can keep being careless and those that need to eventually drop a request before it has a response available can. The API could be as simple and straight forward with same fetch API signature but its returned object is not a Promise, jsut a wrap of a Promise with a `.fetch` property that points to the fetch result so that a polyfill would look like the following: ```js const request = (...args) => { let dropped = false; let f = fetch(...args); let c = r => dropped ? null : r; let p = f.then(c, c).catch(c); return { drop: () => dropped = true, then: (...args) => p.then(...args), catch: (...args) => p.catch(...args) }; }; ``` If that's even an option I hope this thread will be closed. Best Regards --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/27#issuecomment-178055186
Received on Monday, 1 February 2016 16:26:05 UTC