add a vim-like command line under :
This commit is contained in:
parent
0ce7f50285
commit
9cac6c3c3e
9 changed files with 332 additions and 69 deletions
22
static/js/dev/live-reload.js
Normal file
22
static/js/dev/live-reload.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
// 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.
|
||||
|
||||
let shouldReload = true;
|
||||
addEventListener("beforeunload", () => {
|
||||
shouldReload = false;
|
||||
});
|
||||
|
||||
await fetch("/dev/live-reload/stall").catch(async () => {
|
||||
while (shouldReload) {
|
||||
try {
|
||||
let response = await fetch("/dev/live-reload/back-up");
|
||||
if (response.status == 200) {
|
||||
window.location.reload();
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue