- From: Noam Rosenthal <notifications@github.com>
- Date: Sat, 10 Jun 2023 08:44:10 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1647/review/1473444205@github.com>
@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<Response> fetchLater(RequestInfo input, optional DeferredRequestInit init = {}); Hmm you're right, it would also be racy if the `reactivate` task is already queued. So we need an atomic exchange thingy, something like: Let `sentState` be "deferred", "scheduled", or "sent", initially "deferred". When deactivating (in document event loop, after `pagehide`): - Set `sentState` to "scheduled". - In parallel: - Wait `backgroundTimeout` millis - Let `currentState` be the result of atomically exchanging `sentState` with "sent" - If `currentState` is `scheduled`, then fetch etc. When reactivating (in document event loop, before `pageshow`): - Let `currentState` be the result of atomically exchanging `sentState` with "deferred" - Let fetchLater's `sent` be true if `currentState` is "sent", otherwise false. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1647#discussion_r1225432200 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/pull/1647/review/1473444205@github.com>
Received on Saturday, 10 June 2023 15:44:15 UTC