ipad: Add timeout message for loading events image
This commit is contained in:
parent
d040edf6a0
commit
c99ad19bba
10
src/ipad.ts
10
src/ipad.ts
@ -23,8 +23,10 @@ document.body.addEventListener('touchmove', (e) => e.preventDefault(), {
|
||||
const calendarImg = document.getElementById('calendar')! as HTMLImageElement;
|
||||
const spinner = document.getElementById('loadingSpinner')!;
|
||||
const errorModal = document.getElementById('errorModal')!;
|
||||
let loadTimeoutId = -1;
|
||||
|
||||
calendarImg.addEventListener('load', () => {
|
||||
clearTimeout(loadTimeoutId);
|
||||
spinner.style.display = 'none';
|
||||
errorModal.style.display = 'none';
|
||||
});
|
||||
@ -53,6 +55,14 @@ function refresh() {
|
||||
calendarImg.src = url.toString();
|
||||
calendarImg.width = window.innerWidth;
|
||||
calendarImg.height = window.innerHeight;
|
||||
|
||||
loadTimeoutId = window.setTimeout(() => {
|
||||
spinner.style.display = 'none';
|
||||
errorModal.style.display = '';
|
||||
const message = errorModal.querySelector('.modal-message')!;
|
||||
message.textContent =
|
||||
'Timed out loading events. Displayed events may not be accurate.';
|
||||
}, 11000);
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => refresh());
|
||||
|
Loading…
Reference in New Issue
Block a user