HTML5 component syntax
Javascript
export default class AppMoadal extends window.HTMLElement {
  constructor () {
    super()

    this.attachShadow({ mode: 'open' })
    this.shadowRoot.appendChild(htmlTemplate.content.cloneNode(true))
    this.shadowRoot.appendChild(cssTemplate.content.cloneNode(true))

  }
  
  static get observedAttributes () {
    return ['title', 'content']
  }

  attributeChangedCallback (name, oldValue, newValue) {
    switch (name) {
      case 'title': this.setTitle(newValue); break
      case 'content': this.setContent(newValue); break
    }
  }
}

// register element
window.customElements.define('app-modal', AppMoadal)