Clean up EventSource when the page is closed/reloaded (#755)
This commit is contained in:
committed by
GitHub
parent
0538c58f1b
commit
7c0d51f8c5
@@ -1,6 +1,10 @@
|
||||
(() => {
|
||||
const eventSource = new EventSource("/__air_internal/sse");
|
||||
|
||||
window.addEventListener('beforeunload', function() {
|
||||
eventSource.close();
|
||||
})
|
||||
|
||||
eventSource.addEventListener('reload', () => {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user