-
Notifications
You must be signed in to change notification settings - Fork 12
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
the proposal doesn't consider using Page Lifecycle API #32
Comments
I might be misunderstanding what you mean but it sounds like you're suggesting pages would use |
I'm wondering about the motivation section, since it talks about some same issues which Page Lifecycle API was designed to solve. So if one would use freeze event, not unload or beforeunload, or not even pagehide, wouldn't that solve some of the issues we have today. And visibilitychange event could be use for some background tab issues. In other words, which cases are left if those events were used. |
I'm assuming you're talking about using events plus existing network APIs like fetch with keepalive or sendBeacon. Some of the goals of PendingBeacon are
JS is paused in BFCache and sometimes when backgrounded and may never be unpaused before the page is discarded. So the only way to achieve "definitely send" is to eagerly send when an event occurs that might result in paused JS. That conflicts with allowing data to accumulate within time limits. We don't want pages sending on every visibility event just in case it might be their last chance to send. Also, no combination of events+sendBeacon can provide the ability to send after a crash or other sudden termination (common on Mobile), so authors who want that will put their data in a beacon. |
There were some discussions around which lifecycle event we should support in this thread #13 (comment) and the API ends up switching from supporting |
Later discussion in #52 (comment) adds more valuable points why we want a dedicated API that bundles these capabilities together. I'll close this bug for now. Feel free to re-open with any other concerns. |
Page Lifecycle API, isn't a proper spec yet, but it is trying to solve some of the issues https://github.com/WICG/unload-beacon/blob/main/README.md#problem-and-motivation talks about. Is there a reason why existing sendBeacon couldn't be used when freeze or visibilitychange event fires?
The text was updated successfully, but these errors were encountered: