fix live reload not letting you navigate away from the page sometimes
This commit is contained in:
parent
67836213f4
commit
56be35e063
1 changed files with 6 additions and 1 deletions
|
@ -1,8 +1,13 @@
|
|||
let shouldReload = true;
|
||||
addEventListener("beforeunload", () => {
|
||||
shouldReload = false;
|
||||
});
|
||||
|
||||
// NOTE: The server never fulfills this request, it stalls forever.
|
||||
// Once the connection is closed, we try to connect with the server until we establish a successful
|
||||
// connection. Then we reload the page.
|
||||
await fetch("/auto-reload/stall").catch(async () => {
|
||||
while (true) {
|
||||
while (shouldReload) {
|
||||
try {
|
||||
let response = await fetch("/auto-reload/back-up");
|
||||
if (response.status == 200) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue