html-element-plus
html-element-plus copied to clipboard
Add a static method to define components
I saw in a post somewhere, and can find it if need be, but it went something like in this pen.
class A {
static define() {
/* in the example pen, I derive the name from the class name and a regex but ballers choice */
window.customElements.define(this.name, this);
}
}
class E extends A {
static name = 'my-element-name';
}
E.define();