Skip to content

Instantly share code, notes, and snippets.

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();
function getDefaultTemplate(
name,
oldnum = 1,
newnum = 1,
target = 1,
color = '#880011'
) {
const width = (newnum / target) * 100 + '%';
return h(
'div',