How to get app start time

I would like to have available at the Main() routine a datetime value of when the app started. I can put some code in extraHeaders and that is well before the Main() routine, but it appears to be 250 to 300 ms after the app started (this time depends on the speed of the internet connection and other factors).

Is there a way to get the start time of the app from AppStudio or the browser? or a way to put a simple script with one datetime assignment at the head of the index.html?

Not sure that’s possible from the client side given the app has to load in the browser subsystem before it can execute anything. Are you trying to time when the host device’s OS starts to load the chrome subsystem, or when your apps HTML first starts to be loaded, or something else?

Your question actually takes me a different direction. I was originally thinking of just when the index.html starts. But maybe I should explain why I was wanting to know, as I think I was off base and asked the wrong question.

This all came from noticing that a PWA app on a 3G cell network takes over 10 seconds and sometimes up to 30 seconds to process and “notify” the app via the onPWAload() event of the upcoming reload. I want to handle these delayed events differently than if they occur during the splash screen sequence. During the splash screen sequence, I will automatically perform the “reload”, while if it’s after the splash sequence, and the user may already be using the app, I’ll notify the user that one exists, but not load it till they accept it.

I was trying to measure how long the splash screen was up once I got to main(), so that I could keep it up for the remaining splash sequence time. And putting the “get datetime” script into the extraHeaders is before the splash screen and after the AppStudio resources are loaded. I think this will give me a close approximation of splash screen duration at Main().

So it sounds like you are trying to control the update and caching process. Perhaps this link will help:

https://medium.com/progressive-web-apps/pwa-create-a-new-update-available-notification-using-service-workers-18be9168d717