UNPKG

iportal

Version:

web-portal

19 lines (14 loc) 549 B
import template from './template.html' // using a template so it only needs to be parsed once, whereas setting // innerHTML directly in the custom element ctor means the HTML would get parsed // for every custom element on the page const tmpl = document.createElement('template') tmpl.innerHTML = template export class AppLogo extends HTMLElement { constructor () { super() const shadowRoot = this.attachShadow({ mode: 'open' }) shadowRoot.appendChild(tmpl.content.cloneNode(true)) } } customElements.define('app-logo', AppLogo)