Created
October 14, 2024 17:06
-
-
Save rarous/b4dff9466392bb05ea1aea4fad857a48 to your computer and use it in GitHub Desktop.
Isomorphic Web Component definition Live Template for Webstorm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {Window} globalScope | |
* @return {typeof $NAME$} | |
*/ | |
export function def$NAME$({ HTMLElement, customElements }) { | |
class $NAME$ extends HTMLElement { | |
static register(tagName = "$TAG$") { | |
this.tagName = tagName; | |
customElements.define(tagName, this); | |
} | |
connectedCallback() { | |
$END$ | |
} | |
} | |
return $NAME$; | |
} | |
if (globalThis.window?.customElements) { | |
def$NAME$(window).register(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment