Skip to content

Add a static method to define components #5

@gingerchew

Description

@gingerchew

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions