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
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD

View File

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