Skip to content

Commit f4f4b31

Browse files
authored
[explainer] Add alternative approch discussions to fetchLater (#81)
Also refer to #3, #30 and whatwg/fetch#1647
1 parent a72d7ca commit f4f4b31

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/fetch-later-api.md

+26
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,32 @@ class PendingBeacon {
138138
}
139139
```
140140

141+
## Alternatives Considered
142+
143+
### 1. BackgroundSync API
144+
145+
The [Background Synchronization API][backgroundsync-api] allows web applications to defer requests to their service worker to handle at a later time, if the device is offline.
146+
147+
However, to use the API requires the control over a service worker from the top-level window open for the origin, which is impossible for 3rd party iframes that want to perform beaconing.
148+
149+
Note that there are discussions ([#3], [#30]) to address PendingBeacon (or fetchLater)'s privacy requirements by reusing BackgroundSync's access permission.
150+
151+
[backgroundsync-api]: https://github.com/WICG/background-sync/blob/main/explainers/sync-explainer.md#the-api
152+
[#3]: https://github.com/WICG/pending-beacon/issues/3#issuecomment-1531639163
153+
[#30]: https://github.com/WICG/pending-beacon/issues/30#issuecomment-1333869614
154+
155+
### 2. BackgroundFetch API
156+
157+
The [Background Fetch API][backgroundfetch-api] provides a way for service workers to defer processing until a user is connected.
158+
159+
Similar to [BackgroundSync API](#1-backgroundsync-api), using BackGroundFetch also requires the control over a service worker, which is impossible for 3rd party iframes that want to perform beaconing.
160+
161+
[backgroundfetch-api]: https://wicg.github.io/background-fetch/
162+
163+
### 3. Other Alternatives
164+
165+
See also PendingBeacon's [Alternative Approaches](alternative-approaches.md).
166+
141167
## Open Discussions
142168

143169
See [Deferred fetching PR](https://github.com/whatwg/fetch/pull/1647).

0 commit comments

Comments
 (0)