-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consider adapting window.fetch API for beaconing #52
Comments
Alternatively, to avoid the piecemeal growth of the BeaconAPI to support more of fetch's options, we could allow all of fetch-options to be passed to a beacon. There are some that might not make sense but we should exclude rather than gradually include. |
The idea of a promise that never resolves makes me uncomfortable. An alternative would be to resolve immediately with some kind of "empty" Response, though I don't concretely know what that would look like. I favour refusing to fetch and returning a rejection if Adding a |
We would probably want Also given my other comment it might not be a good idea to have such a difference in behaviour in terms of header processing just based on an option. TBH, it doesn't seem like a great fit. I'm leaning towards Beacon should take a fetch-options input rather than fetch should be able to act like beacon. |
I think reusing
Most of the interesting parts of this API are in (1). And we don't want to decouple them, because (1) by itself is too much power to give developers. We want them running less JavaScript at I think turning A strained analogy would be how image loading is a no-cors fetch plus drawing the image. We don't extend no-cors All that said, I think we could consider ways to align the surface area of the unload beacon API, especially its inputs, with Continuing the strained analogy from the above, this would be the equivalent of replacing |
Part of my worry here is around API surface and keeping everything synchronized. This was problematic with |
Though having looked a bit more at the classes this does seem like a wild departure from And it also has weird restrictions such that you can update the body with |
The API is repurposed into |
@annevk @philipwalton @clelland
Forking off from this comment.
It's not that keepalive is fundamentally broken, it's that the there is reliable way to initiate these kinds of fetches from JS and there cannot be. You must either oversend or accept losing a lot of fetches (especially on mobile).
If we really wanted to keep using window.fetch, then we could perhaps add a
defer-send
option.Such a fetch would
The existing abort
signal
option would give us control over cancelling. We would probably want more options that only apply to deferred fetches to deal with timing.Are there options on fetches that we would want to disallow for a deferred fetch?
The text was updated successfully, but these errors were encountered: