Wait to sync before export

This commit is contained in:
Sidharth Vinod
2024-01-18 21:24:42 +05:30
parent 675af38c49
commit 2033f1add0
+8 -1
View File
@@ -30,7 +30,14 @@
return toBase64(svgString);
};
const exportImage = (event: Event, exporter: Exporter) => {
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
const exportImage = async (event: Event, exporter: Exporter) => {
let tries = 50;
while (document.querySelector('.outOfSync') && tries > 0) {
await sleep(100);
tries--;
}
if (document.querySelector('.outOfSync')) {
throw new Error('Diagram is out of sync');
}