fix: use async in render-after-error

This commit is contained in:
Sidharth Vinod
2022-10-06 17:49:10 +08:00
parent 646a96e5f0
commit d59f878020

View File

@@ -14,15 +14,16 @@
mermaid.init({ startOnLoad: false }); mermaid.init({ startOnLoad: false });
mermaid.mermaidAPI.initialize({ securityLevel: 'strict' }); mermaid.mermaidAPI.initialize({ securityLevel: 'strict' });
(async () => {
try { try {
console.log('rendering'); console.log('rendering');
mermaid.mermaidAPI.render('graphDiv', `>`); await mermaid.mermaidAPI.render('graphDiv', `>`);
} catch (e) {} } catch (e) {}
mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => { await mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
document.getElementById('graph').innerHTML = html; document.getElementById('graph').innerHTML = html;
}); });
})();
</script> </script>
</body> </body>
</html> </html>