-
Notifications
You must be signed in to change notification settings - Fork 0
/
arm-viz-settings.element.mjs
58 lines (43 loc) · 1.26 KB
/
arm-viz-settings.element.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
export default class ArmVizSettings extends HTMLElement {
constructor () {
super();
console.info(`TODO: figure out what this component should actually do. What goes into 'settings'?
* axis mapping (time, timing, size,...)
* chart type (bar, scatter, ...)
* storage (sessionStorage?)`);
this.constructor.observedAttributes.forEach((attr) => {
this[attr] = this.getAttribute(attr) || this.constructor[`default_${attr}`];
});
this.attachShadow({ mode: "open" });
this.shadowRoot.appendChild(this.constructor.buildTemplate().content.cloneNode(true));
}
connectedCallback () {
}
adoptedCallback () {
}
disconnectedCallback () {
}
attributeChangedCallback (attrName, oldVal, newVal) {
const funcName = `${attrName}AttrChanged`;
if (typeof this[funcName] === "function") {
this[funcName](newVal);
} else {
console.info(`No handler registered for attr ${attrName}`);
}
}
static get observedAttributes () {
return [
`path`,
];
}
static buildTemplate () {
const tmpl = document.createElement("template");
tmpl.innerHTML = /* html */`
`;
return tmpl;
}
static get is () {
return `arm-viz-settings`;
}
}
customElements.define(ArmVizSettings.is, ArmVizSettings);