Modifying PWA.js code

If the above revision is made to asF.js, it can be used two ways. One is the above example. The other is to set a flag in the UI, like a notification bell with a badge that says Update Available. But do not do the reload. The user will still be running on the old version of the software. When they click on the notification you an present a Do you want to update? and if so, then do the location.reload().

Depending upon your update philosophy, this should give you most of all worlds. The final consideration is that I would like my users to be on the latest version. To use the second option would not guarantee the user would ever update. To ensure the user does update would probably involve some sort of server interaction, like an update control you could ajax read from the server. Remember update is just location.reload(), even if one is not “available”. It doesn’t hurt to just do a reload of the same pages.