Skip to content

Instantly share code, notes, and snippets.

@aramvr
Last active January 27, 2020 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aramvr/de18d7269b946d8d469d9aecf96d21bf to your computer and use it in GitHub Desktop.
Save aramvr/de18d7269b946d8d469d9aecf96d21bf to your computer and use it in GitHub Desktop.
Web Components sample
let template = document.getElementById("error-message-template");
// template is any HTML based content. Elements, styles, etc.
class ErrorMessage extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
this.shadowRoot.appendChild(template.content);
}
}
window.customElements.define('error-message', ErrorMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment