Skip to content

Commit

Permalink
Avoid duplicate initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jared-hughes committed May 10, 2021
1 parent 792898b commit 659a257
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function injectElement() {
const insertSVGElement = document.getElementById(
"insertSVG"
) as HTMLInputElement;
(window as any).svgToDesmosInputElement = insertSVGElement;
insertSVGElement.addEventListener("change", async () => {
const file = insertSVGElement.files?.[0];
if (file === undefined) return;
Expand All @@ -21,4 +22,6 @@ function injectElement() {
});
}

injectElement();
if ((window as any).svgToDesmosInputElement === undefined) {
injectElement();
}

0 comments on commit 659a257

Please sign in to comment.