@jsx6/jsx6
TypeScript icon, indicating that this package has built-in type declarations

1.8.7 • Public • Published

JSX6

web components tricks

vanilla JS automatic registration using static initilaizer

  class MyCustomElement extends HTMLElement{
    static { customElements.define('my-custom-element', this) } 
  }

or let user define the component and even change the element name

  class MyCustomElement extends HTMLElement {
    static define(tag='my-custom-element'){ customElements.define(tag, this) } 
  }
  // in that case user must call define before using it
  MyCustomElement.define()

Readme

Keywords

Package Sidebar

Install

npm i @jsx6/jsx6

Weekly Downloads

79

Version

1.8.7

License

MIT

Unpacked Size

162 kB

Total Files

44

Last publish

Collaborators

  • hrgdavor