Skip to content

Commit 46069a9

Browse files
authored
Merge pull request #8108 from gth001/master
This fixes the issue of a "stale" CGM value displaying indefinately.
2 parents 085590b + 476bad9 commit 46069a9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

views/clockviews/clock.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@
9292
window.addEventListener('click', function() {
9393
showClose();
9494
});
95+
96+
// This fixes the issue of a "stale" CGM value displaying indefinately.
97+
// It displays "Internet offline." until internet is restored.
98+
function uOffline() {
99+
document.body.innerHTML =
100+
'Internet offline.'
101+
}
102+
// Return to normal as soon as internet connectivity is restored.
103+
function uOnline() {
104+
location.reload()
105+
}
106+
if(window.addEventListener) {
107+
window.addEventListener('offline', uOffline);
108+
window.addEventListener('online', uOnline);
109+
} else {
110+
document.body.attachEvent('onoffline', uOffline);
111+
document.body.attachEvent('ononline', uOnline);
112+
}
113+
95114
<% } %>
96115
</script>
97116
<%if (face == 'config') { %>

0 commit comments

Comments
 (0)