Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Close event source before window is unloaded #945

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion sapper-dev-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@ export function connect(port) {
check();
}
};
}

// Close the event source before the window is unloaded to prevent an error
// ("The connection was interrupted while the page was loading.") in Firefox
// when the page is reloaded.
window.addEventListener('beforeunload', function() {
source.close();
});
}