const TEMPLATE = document.createElement("template"); class NextBusElement extends HTMLElement { #stop get stopId(){ return this.#stop } set stopId(value){ this.#stop = value this.updateContent() } connectedCallback(){ this.replaceChildren(TEMPLATE.content.cloneNode(true)) } updateContent(){ } static observedAttributes = ["stop-id"] attributeChangedCallback(name, oldVal, newVal){ switch(name){ case "stop-id": this.stopId = newVal break; } } } customElements.define("camp-next-bus", NextBusElement);