Clean up EventSource when the page is closed/reloaded (#755)

This commit is contained in:
Halvdan Hoem Grelland
2026-01-12 15:37:24 +01:00
committed by GitHub
parent 0538c58f1b
commit 7c0d51f8c5
+4
View File
@@ -1,6 +1,10 @@
(() => {
const eventSource = new EventSource("/__air_internal/sse");
window.addEventListener('beforeunload', function() {
eventSource.close();
})
eventSource.addEventListener('reload', () => {
location.reload();
});