class BesPopupEl extends HTMLElement { constructor() { super() this.attachShadow({ mode: 'open' }) } connectedCallback() { this.render() } render() { this.shadowRoot.innerHTML = `
Tole je testni popup
` } show(x, y) { y = y + 20 this.style.position = 'fixed' this.style.left = `${x}px` this.style.top = `${y}px` this.classList.add('show') } hide() { this.classList.remove('show') } changeText(text) { this.shadowRoot.querySelector('.popup-text').textContent = text } } customElements.define('bes-popup-el', BesPopupEl)