feat: registry object

This commit is contained in:
Ayo 2023-10-07 21:59:10 +02:00
parent 7110fe779b
commit 88529ca8d1

View file

@ -1,2 +1,13 @@
import HelloWorld from "/components/hello-world.js";
customElements.define("hello-world", HelloWorld);
/**
* Map of custom element name to the class constructor
*/
const registry = {
"hello-world": HelloWorld,
};
Object.keys(registry).forEach((key) => {
if (window?.hasOwnProperty("customElements"))
customElements.define(key, registry[key]);
});