diff --git a/public/registry.js b/public/registry.js index d2831dd..75123c8 100644 --- a/public/registry.js +++ b/public/registry.js @@ -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]); +});