Re: [whatwg/fetch] Deferred fetching (PR #1647)

@noamr commented on this pull request.



> @@ -8449,6 +8597,60 @@ with a <var>promise</var>, <var>request</var>, <var>responseObject</var>, and an
 </div>
 
 
+<h3 id=fetch-later-method>FetchLater method</h3>
+
+<pre class=idl>
+
+dictionary DeferredRequestInit : RequestInit {
+  DOMHighResTimeStamp backgroundTimeout;
+};
+
+partial interface mixin WindowOrWorkerGlobalScope {
+  [NewObject] Promise&lt;Response> fetchLater(RequestInfo input, optional DeferredRequestInit init = {});

> I'm not sure why this is assuming that the fetch would have happened while in bfcache. If the user goes back quickly that won't be the case, though it might still happen due to it already being enqueued for delivery for instance.

At the very least, it *could* happen while in BFCache.
> 
> I think you would need a class that exposes both sent state and a promise for when that sent state is ready.

That would work!

> 
> However, if `fetchLater()` doesn't return a promise how do we deal with network errors and policy violations and such?

You generally don't; you only care about whether the fetch is transmitted. As in the regular unload case (not bfcache) you don't get this promise.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1647#discussion_r1221336627
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1647/review/1467272450@github.com>

Received on Wednesday, 7 June 2023 10:22:15 UTC