WICG / pending-beacon

A better beaconing API
Other
43 stars 8 forks source link

[Fetch-Based API] `SendSignal` #75

Closed mingyc closed 9 months ago

mingyc commented 1 year ago

Context: #70 #71

This is to observe a event to tell if a deferSend request is still pending.

To prevent from data races, the underlying implementation should ensure that renderer is authoritative to the request's send state when it's alive. Similar to this discussion for PendingBeacon.

noamr commented 1 year ago

See [https://github.com/WICG/pending-beacon/issues/70#issuecomment-1486404787]. I wonder if we need sentSignal, given a per-origin quota instead of a global quota for beacons.

mingyc commented 1 year ago

noamr@ Could you tell why sentSignal is bound to request quota?

Another reason to have it (or pending state) is to tell if the request has been sent if it stays in BFCache for more than backgroundTimeout

noamr commented 1 year ago

noamr@ Could you tell why sentSignal is bound to request quota?

Another reason to have it (or pending state) is to tell if the request has been sent if it stays in BFCache for more than backgroundTimeout

If the document is in BFCache, how would you receive that promise? When you're restored from BFCache?

mingyc commented 1 year ago

It can only be received and triggered after restored from BFCache. But at least users can know that their request has been sent.

mingyc commented 9 months ago

SendSignal is now the returned FetchLaterResult.activated field in fetchLater() API. See https://whatpr.org/fetch/1647.html#dom-fetchlaterresult-activated