mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 14:29:25 +02:00
chore: Add build times to live reload
This commit is contained in:
@@ -51,8 +51,10 @@ function handleFileChange() {
|
|||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
timeoutId = setTimeout(async () => {
|
timeoutId = setTimeout(async () => {
|
||||||
|
const time = Date.now();
|
||||||
await rebuildAll();
|
await rebuildAll();
|
||||||
sendEventsToAll();
|
sendEventsToAll();
|
||||||
|
console.log('Rebuild & Refresh complete in' + (Date.now() - time) + 'ms');
|
||||||
timeoutId = undefined;
|
timeoutId = undefined;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
<title>Mermaid development page</title>
|
<title>Mermaid development page</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<pre class="mermaid">info</pre>
|
||||||
|
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
graph TB
|
graph TB
|
||||||
a --> b
|
a --> b
|
||||||
@@ -44,8 +46,8 @@ graph TB
|
|||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
events.onerror = (error) => {
|
events.onerror = () => {
|
||||||
console.error(error);
|
// No need to log this error, as it's not useful.
|
||||||
events.close();
|
events.close();
|
||||||
// Try to reconnect after 1 second in case of errors
|
// Try to reconnect after 1 second in case of errors
|
||||||
setTimeout(connectToEvents, 1000);
|
setTimeout(connectToEvents, 1000);
|
||||||
@@ -55,7 +57,7 @@ graph TB
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (liveReload) {
|
if (liveReload) {
|
||||||
connectToEvents();
|
setTimeout(connectToEvents, 1000);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
Reference in New Issue
Block a user