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 Dec 17, 2024
1 parent bf470ff commit 7355e2b
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 @@ -29,7 +29,7 @@ ws.addEventListener('open', () => {
ws.send(`PATH: ${window.VIV_PATH}`);
});

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 @@ -38,9 +38,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 7355e2b

Please sign in to comment.