Skip to content

Commit

Permalink
refactor(#194): async message listener
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Jan 21, 2025
1 parent dd58f58 commit 7d35b0d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions static/client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ try {

const ws = new WebSocket(`ws://localhost:${window.VIV_PORT}`);

ws.addEventListener('message', (event) => {
ws.addEventListener('message', async (event) => {
const fields = event.data.toString().split(': ');
if (fields.length < 2) return;
const [key, ...values] = fields;
Expand All @@ -34,9 +34,7 @@ ws.addEventListener('message', (event) => {
switch (key) {
case 'UPDATE':
document.getElementById('body-content').innerHTML = value;
(async () => {
await mermaid.run({ querySelector: '.mermaid' });
})();
await mermaid.run({ querySelector: '.mermaid' });
break;

case 'SCROLL':
Expand Down

0 comments on commit 7d35b0d

Please sign in to comment.