chore: Add build times to live reload

This commit is contained in:
Sidharth Vinod
2023-08-13 20:17:30 +05:30
parent 9fb9bed806
commit fc99d9be41
2 changed files with 7 additions and 3 deletions

View File

@@ -51,8 +51,10 @@ function handleFileChange() {
clearTimeout(timeoutId);
}
timeoutId = setTimeout(async () => {
const time = Date.now();
await rebuildAll();
sendEventsToAll();
console.log('Rebuild & Refresh complete in' + (Date.now() - time) + 'ms');
timeoutId = undefined;
}, 100);
}

View File

@@ -5,6 +5,8 @@
<title>Mermaid development page</title>
</head>
<body>
<pre class="mermaid">info</pre>
<pre id="diagram" class="mermaid">
graph TB
a --> b
@@ -44,8 +46,8 @@ graph TB
location.reload();
}
};
events.onerror = (error) => {
console.error(error);
events.onerror = () => {
// No need to log this error, as it's not useful.
events.close();
// Try to reconnect after 1 second in case of errors
setTimeout(connectToEvents, 1000);
@@ -55,7 +57,7 @@ graph TB
};
};
if (liveReload) {
connectToEvents();
setTimeout(connectToEvents, 1000);
}
</script>
</body>