Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript
615 B
Raw Blame
/* global HTMLElement, customElements */
class SSEConnection extends HTMLElement {
  connectedCallback () {
    this.render(window.eventSource && window.eventSource.readyState === 'OPEN')
  }

  static get observedAttributes () {
    return ['connected']
  }

  attributeChangedCallback (name, _, newValue) {
    this.render(window.eventSource && window.eventSource.readyState === 'OPEN')
  }

  render (connected = false) {
    if (connected) this.classList.add('connected')
    else this.classList.remove('connected')
    this.innerHTML = /* html */''
  }
}
customElements.define('sse-connection', SSEConnection)