mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
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:
@@ -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') { %>
|
||||
|
||||
Reference in New Issue
Block a user