feat: registry object
This commit is contained in:
parent
7110fe779b
commit
88529ca8d1
1 changed files with 12 additions and 1 deletions
|
@ -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]);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue