This fixes the issue of a "stale" CGM value displaying indefinately. It displays "Internet offline." until internet is restored.

This fix addresses the issue that with a lost internet connection, clock view continues to display a stale CGM values forever, with no clue that internet connectivity is lost. This fix shows "Internet offline." for the duration that is it lost, then returns to normal when internet is restored.
This commit is contained in:
gth001
2023-10-15 22:06:26 -07:00
committed by GitHub
parent a09e586b95
commit 1f56b15fb2
+19
View File
@@ -92,6 +92,25 @@
window.addEventListener('click', function() {
showClose();
});
// This fixes the issue of a "stale" CGM value displaying indefinately.
// It displays "Internet offline." until internet is restored.
function uOffline() {
document.body.innerHTML =
'Internet offline.'
}
// Return to normal as soon as internet connectivity is restored.
function uOnline() {
location.reload()
}
if(window.addEventListener) {
window.addEventListener('offline', uOffline);
window.addEventListener('online', uOnline);
} else {
document.body.attachEvent('onoffline', uOffline);
document.body.attachEvent('ononline', uOnline);
}
<% } %>
</script>
<%if (face == 'config') { %>