Skip to content

Commit

Permalink
fix: Avoid duplicate element definition if already defined (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
sqozz authored Apr 10, 2024
1 parent 9ce1140 commit fda900a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/valetudo-map-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -1048,12 +1048,15 @@ class ValetudoMapCard extends HTMLElement {
}
}

customElements.define("valetudo-map-card", ValetudoMapCard);

window.customCards = window.customCards || [];
window.customCards.push({
type: "valetudo-map-card",
name: "Valetudo Map Card",
preview: false,
description: "Display the Map data of your Valetudo-enabled robot",
});
let componentName = "valetudo-map-card";
if (!customElements.get(componentName)) {
customElements.define(componentName, ValetudoMapCard);

window.customCards = window.customCards || [];
window.customCards.push({
type: componentName,
name: "Valetudo Map Card",
preview: false,
description: "Display the Map data of your Valetudo-enabled robot",
});
}

0 comments on commit fda900a

Please sign in to comment.