How to trace the opening of the PWA?

Is PWA and I need to figure out when a user opens (with screen)
How to do it?
April 19th 20 at 12:06
1 answer
April 19th 20 at 12:08
I wanted to reply to that when you install on home screen events occur
https://github.com/w3c/manifest/issues/699

but it turned out that now there's a simple media query for this, see
https://stackoverflow.com/a/51735941
(I haven't tried, don't know how it works)

if (window.matchMedia('(display-mode: standalone)').matches) { 
 // do things here 
 // set a variable to be used when calling something 
 // e.g. call Google Analytics to track use standalone 
}
not that I need to understand when each time the user opens the pwa - Kristopher_Stroman commented on April 19th 20 at 12:11
@Kristopher_Stroman, and just switches between tabs or apply?

document.addEventListener("visibilitychange", function() {
 if (document.visibilityState === 'visible') {
console.log('hi')
 // here you can refresh data from DB
}
});


^ the listener to put in the main component of the APPA - will.Zula commented on April 19th 20 at 12:14
@will.Zula, La thank you beautiful III - Kristopher_Stroman commented on April 19th 20 at 12:17

Find more questions by tags JavaScript