Skip to content

Commit

Permalink
fix: add conditional check to only register custom component once
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenColEvol committed May 20, 2024
1 parent e76cc8e commit ec7c921
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/compare.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
const DIFF_WRAPPER = "cs-compare";

export function registerCompareElement() {
class Compare extends HTMLSpanElement {
constructor() {
super();
}
}

customElements.define("cs-compare", Compare);
if (!customElements.get(DIFF_WRAPPER)) {
customElements.define(DIFF_WRAPPER, Compare);
}
}

0 comments on commit ec7c921

Please sign in to comment.