Contact Info
Reach us directly. Every message is read by a person.
Bize bir mesaj gönderin
Formu doldurun ve size ulaşacağız.
Powered by sendform.net
Reach us directly. Every message is read by a person.
Formu doldurun ve size ulaşacağız.
Powered by sendform.net
let es = null; let reconnectTimer = null; let connectedOnce = false; let pingReceived = false; function startEventSource() { if (es) { es.close(); es = null; } // console.log("[hotreload] opening SSE connection"); pingReceived = false; es = new EventSource("/hot.reload"); es.addEventListener("ping", () => { // console.log("[hotreload] ping event received"); pingReceived = true; connectedOnce = true; }); es.onerror = (e) => { // console.log("[hotreload] SSE error", e); if (pingReceived) { // console.log("[hotreload] connection lost after ping - reloading page"); // The server is restarting: every request in flight now fails, // and the page reloads in a moment anyway. Keep the global // error interceptor from popping its "offline" dialog meanwhile. if (window.CMS_ERRORS && typeof window.CMS_ERRORS.suppressFor === "function") { window.CMS_ERRORS.suppressFor(15000); } setTimeout(() => { window.location.reload(); }, 1200); if (window.toast && typeof window.toast.info === "function") { window.toast.info("File Change detected. Refreshing page..."); } } else { // console.log("[hotreload] no ping yet - reconnecting only"); restartEventSource(); } }; // Force reconnect before CF kills the connection if (reconnectTimer) clearTimeout(reconnectTimer); reconnectTimer = setTimeout(restartEventSource, 50000); } function restartEventSource() { // console.log("[hotreload] restarting SSE connection"); startEventSource(); } window.addEventListener("pagehide", () => { pingReceived = false; if (reconnectTimer) clearTimeout(reconnectTimer); if (es) { es.close(); es = null; } }); window.addEventListener("pageshow", (event) => { if (event.persisted) startEventSource(); }); startEventSource(); l>