Perf: Prioritäts-Seiten pre-cache + Stale-While-Revalidate + Background-Warm-up (SW by-v981)
This commit is contained in:
parent
78f3077317
commit
1a8716b0b2
3 changed files with 48 additions and 8 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '980'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '981'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
||||
|
|
@ -1140,6 +1140,19 @@ const App = (() => {
|
|||
window.App = App; // Worlds kann App.navigate() aufrufen
|
||||
|
||||
// App starten
|
||||
// Prioritäts-Seiten im Hintergrund vorladen (3s nach Start, damit Hauptinhalt nicht blockiert)
|
||||
window.addEventListener('load', () => {
|
||||
setTimeout(() => {
|
||||
if (!('caches' in window)) return;
|
||||
['admin','erste-hilfe','diary','map','walks','routes','poison','lost'].forEach(page => {
|
||||
const key = `Page_${page.replace(/-/g,'_')}`;
|
||||
if (!window[key]) {
|
||||
fetch(`/js/pages/${page}.js?v=${APP_VER}`).catch(() => {});
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
App.init();
|
||||
if (IS_STAGING) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue