Skip to content

Commit

Permalink
Merge pull request #190 from kevinkucharczyk/safer-custom-elements-de…
Browse files Browse the repository at this point in the history
…finition

Don't call customElements.define if definition already exists
  • Loading branch information
simonihmig committed May 7, 2024
2 parents 4c21907 + 1a761fc commit 9396f3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vendor/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,9 @@
}
}

customElements.define('###CENAME###', EmbeddedApp);
let definition = customElements.get('###CENAME###');

if (definition == null) {
customElements.define('###CENAME###', EmbeddedApp);
}
})();

0 comments on commit 9396f3f

Please sign in to comment.