fix idnentation in node.js
This commit is contained in:
parent
438e220db0
commit
8d0880346e
46
node.js
46
node.js
@ -1,32 +1,32 @@
|
|||||||
class Node extends HTMLElement {
|
class Node extends HTMLElement {
|
||||||
constructor () { // <link rel="stylesheet" href="style.css" type="text/css">
|
constructor () { // <link rel="stylesheet" href="style.css" type="text/css">
|
||||||
super();
|
super();
|
||||||
let shadowRoot = this.attachShadow({mode: "open"});
|
let shadowRoot = this.attachShadow({mode: "open"});
|
||||||
|
|
||||||
let nodeArticle = document.createElement("article");
|
let nodeArticle = document.createElement("article");
|
||||||
shadowRoot.append(nodeArticle);
|
shadowRoot.append(nodeArticle);
|
||||||
|
|
||||||
let styleLink = document.createElement("link");
|
let styleLink = document.createElement("link");
|
||||||
styleLink.rel = "stylesheet";
|
styleLink.rel = "stylesheet";
|
||||||
styleLink.href = "style.css";
|
styleLink.href = "style.css";
|
||||||
styleLink.type = "text/css";
|
styleLink.type = "text/css";
|
||||||
shadowRoot.append(styleLink);
|
shadowRoot.append(styleLink);
|
||||||
|
|
||||||
this.shadowElement = shadowRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
set data (data) {
|
this.shadowElement = shadowRoot;
|
||||||
let articleElement = this.shadowElement.querySelector("article");
|
}
|
||||||
|
|
||||||
let nodeName = document.createElement("h2");
|
set data (data) {
|
||||||
nodeName.innerText = data.node;
|
let articleElement = this.shadowElement.querySelector("article");
|
||||||
articleElement.append(nodeName);
|
|
||||||
|
|
||||||
let onlineLabel = document.createElement("h3");
|
let nodeName = document.createElement("h2");
|
||||||
onlineLabel.innerText = data.status;
|
nodeName.innerText = data.node;
|
||||||
onlineLabel.style.color = data.status === "online" ? "#00ff00" : "#ff0000";
|
articleElement.append(nodeName);
|
||||||
articleElement.append(onlineLabel);
|
|
||||||
}
|
let onlineLabel = document.createElement("h3");
|
||||||
|
onlineLabel.innerText = data.status;
|
||||||
|
onlineLabel.style.color = data.status === "online" ? "#00ff00" : "#ff0000";
|
||||||
|
articleElement.append(onlineLabel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("node-card", Node);
|
customElements.define("node-card", Node);
|
Loading…
Reference in New Issue
Block a user