Skip to content

Commit

Permalink
improve custom element reg
Browse files Browse the repository at this point in the history
  • Loading branch information
blidblid committed Aug 10, 2024
1 parent d516677 commit a3f3b34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
8 changes: 1 addition & 7 deletions libs/core/src/lib/components/layout/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@ export class BergLayoutElement extends WebComponent<BergLayoutInputs> {
}
}

try {
if (!customElements.get(BERG_LAYOUT_TAG_NAME)) {
customElements.define(BERG_LAYOUT_TAG_NAME, BergLayoutElement);
} catch (e) {
console.warn(
`${BERG_LAYOUT_TAG_NAME} is already defined as a web component.`
);

throw e;
}
7 changes: 2 additions & 5 deletions libs/core/src/lib/components/panel/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ export class BergPanelElement extends WebComponent<BergPanelInputs> {
</style>
<div class="berg-panel-overflow" part="overflow">
<div class="berg-panel-content" part="content">
<div part="content">
<slot></slot>
</div>
</div>`;
Expand All @@ -641,9 +641,6 @@ export class BergPanelElement extends WebComponent<BergPanelInputs> {
}
}

try {
if (!window.customElements.get(BERG_PANEL_TAG_NAME)) {
customElements.define(BERG_PANEL_TAG_NAME, BergPanelElement);
} catch (e) {
console.warn(`${BERG_PANEL_TAG_NAME} is already defined as a web component.`);
throw e;
}

0 comments on commit a3f3b34

Please sign in to comment.