class CustomPlayerCard extends HTMLElement {
static get observedAttributes() {
return ['name', 'team', 'position', 'salary', 'fppg', 'image'];
}
attributeChangedCallback(name, oldValue, newValue) {
if (this.shadowRoot) {
this.render();
}
}
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.render();
}
render() {
const name = this.getAttribute('name') || '';
const team = this.getAttribute('team') || '';
const position = this.getAttribute('position') || '';
const salary = this.getAttribute('salary') || '0';
const fppg = this.getAttribute('fppg') ||