diff options
author | Vitaly Takmazov | 2022-10-12 04:51:03 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-10-12 04:51:03 +0300 |
commit | 89c1e36e31c1cd7879b6a37723ae19960f430d97 (patch) | |
tree | c211893cc6ca6576b9d77833ee2799bb14e54bdc /src | |
parent | c290fb5df36571012d7a1e78b8b96aed6ab388ba (diff) |
Events: correctly shutdown EventSource connection
Diffstat (limited to 'src')
-rw-r--r-- | src/main/assets/scripts.js | 9 |
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(); }); |