Skip to content

Commit

Permalink
feat: fix CodeMirror retrying
Browse files Browse the repository at this point in the history
  • Loading branch information
mkpoli committed Oct 19, 2024
1 parent f5536ff commit 6845405
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ setTimeout(() => {
if (wrappers.length > 0) {
kojiWrapper = wrappers[0] as HTMLDivElement;
editor = new KojiEditor(kojiWrapper);
console.log("[honkoku-toolbox] KojiEditor initialized: ", editor);
clearInterval(interval);
}
if (retries > MAX_RETRIES) {
Expand All @@ -52,6 +53,7 @@ setTimeout(() => {
}, 500);
} else {
editor = new KojiEditor(kojiWrapper);
console.log("[honkoku-toolbox] KojiEditor initialized: ", editor);
}
return;
}
Expand All @@ -65,6 +67,7 @@ setTimeout(() => {
};
cm = codeMirror.CodeMirror;
editor = new CodeMirrorEditor(cm);
console.info("[honkoku-toolbox] CodeMirrorEditor initialized: ", editor);
} else {
let retries = 0;
const interval = setInterval(() => {
Expand All @@ -75,7 +78,13 @@ setTimeout(() => {
};
cm = codeMirror.CodeMirror;
editor = new CodeMirrorEditor(cm);
console.info("[honkoku-toolbox] CodeMirrorEditor initialized: ", editor);
clearInterval(interval);
} else {
if (retries > MAX_RETRIES) {
clearInterval(interval)
}
retries++;
}
}, 500);
}
Expand Down

0 comments on commit 6845405

Please sign in to comment.