Skip to content

Instantly share code, notes, and snippets.

@dalaidunc
Created October 31, 2018 18:40
Show Gist options
  • Save dalaidunc/f7129cf1d8548e40b91e261ef2b055e9 to your computer and use it in GitHub Desktop.
Save dalaidunc/f7129cf1d8548e40b91e261ef2b055e9 to your computer and use it in GitHub Desktop.
class SocialStats extends HTMLElement {
static get observedAttributes() {
return ['oldnum', 'newnum', 'colour', 'target', 'name'];
}
constructor() {
super();
this.shadow = this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.css = getDefaultStyle();
this.template = getDefaultTemplate(
...['name', 'oldnum', 'newnum', 'target', 'colour'].map(name => {
return this.getAttribute(name);
})
);
this.shadow.appendChild(this.css);
this.shadow.appendChild(this.template);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment