aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/assets/scripts.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js
index 97525940..b103810d 100644
--- a/src/main/assets/scripts.js
+++ b/src/main/assets/scripts.js
@@ -105,7 +105,9 @@ function i18n(key = '', lang = undefined) {
|| key;
}
-var es, pageTitle;
+/** @type { EventSource } */
+var es;
+var pageTitle;
function initES() {
if (!('EventSource' in window)) {
@@ -782,6 +784,11 @@ ready(() => {
}
});
initES();
+ addEventListener('beforeunload', () => {
+ if (es) {
+ es.close();
+ }
+ });
embedAll();
});