page lifecycle
See original GitHub issueBug Report
Problem
The cordova-android lifecycle clashes with the page lifecycle spec.
What is expected to happen?
There should be some integration between cordova lifecycle and the page lifecycle
What does actually happen?
The cordova even ‘resume’ name clashes with ‘resume’ of page lifecycle
Information
The browser pause
event could be a proxy of freeze
. currently pause
will trigger even on a browser tab change, which makes sense on the mobile webview, but not so much on a browser.
Command or Code
The easiest way to test integration with page lifecycle that I found so far is with chrome://discards/
as stated here https://developers.google.com/web/updates/2018/07/page-lifecycle-api#testing-your-app-in-the-frozen-and-discarded-states
Environment, Platform, Device
Tested with cordova-android and cordova-browser
Version information
Cordova: 9.0
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Page Lifecycle API - Chrome Developers
The Page Lifecycle API brings app lifecycle features common on mobile operating systems to the web. Browsers are now able to safely freeze ......
Read more >Page Lifecycle
Frozen: lifecycle state for CPU suspension. This means that the freeze steps algorithm was called on the Document 's browsing context.
Read more >Deep Dive into Page Lifecycle API | by Viduni Wickramarachchi
As the name suggests, the Page Lifecycle API exposes the web page lifecycle hooks to JavaScript. However, it isn't an entirely new concept....
Read more >GoogleChromeLabs/page-lifecycle: PageLifecycle.js ... - GitHub
PageLifecycle.js is a tiny JavaScript library (<1K gzipped) that allows developers to easily observe Page Lifecycle API state changes and implement Page ...
Read more >ASP.NET Page Life Cycle Overview - Microsoft Learn
When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @janpio I got around this by checking the user agent before adding the event listener to filter the desktop browser which works even for the webview build (https://developer.chrome.com/multidevice/user-agent):
I realize that the page lifecycle events are not implemented on other browsers and that some applications might depend on current behavior of
cordova-browser
events so closing this one for now, thanksThe easiest way to find out (and also later to test and verify any implementation in
cordova-browser
) would be a super simple Cordova app /index.html
that outputs the events that are occuring either in the console or in a div on a page.Could you create one of those and put them on GitHub? (Bonus points if you follow these instructions for a minimal reproduction repository: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md - because that will minimize the time we contributors have to spend to set this up.)