26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
let historyResizeTimer;
|
|
window.addEventListener('resize', () => { if (app.currentView === 'history') { clearTimeout(historyResizeTimer); historyResizeTimer = setTimeout(drawCurrentChartIfVisible, 120); } });
|
|
window.matchMedia('(prefers-color-scheme: light)').addEventListener('change', () => { if (app.theme === 'system') applyTheme(); });
|
|
if ('serviceWorker' in navigator) window.addEventListener('load', () => navigator.serviceWorker.register(withBase('/sw.js')).catch(() => { }));
|
|
|
|
async function startApplication() {
|
|
try {
|
|
observeTopbarHeight();
|
|
applyTheme();
|
|
await loadLanguages();
|
|
applyTranslations();
|
|
} finally {
|
|
document.documentElement.classList.remove('i18n-loading');
|
|
}
|
|
setupFormUx();
|
|
updateZoneSensorFields();
|
|
updateSchedulePresetField();
|
|
await loadBootstrap();
|
|
initRouter();
|
|
}
|
|
|
|
setInterval(updateLocalThermostatCountdowns, 1000);
|
|
setInterval(updateTemporaryThermostatCountdowns, 1000);
|
|
setInterval(updateCompressorQueueCountdowns, 1000);
|
|
startApplication().catch(error => console.error('Application startup failed:', error));
|