Skip to content

Commit

Permalink
This fixes the issue of a "stale" CGM value displaying indefinately. …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
gth001 authored Oct 16, 2023
1 parent a09e586 commit 1f56b15
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions views/clockviews/clock.html
Original file line number Diff line number Diff line change
Expand Up @@ -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') { %>
Expand Down

0 comments on commit 1f56b15

Please sign in to comment.