Skip to content

Instantly share code, notes, and snippets.

@FlyingThunder
Last active December 3, 2025 07:56
Show Gist options
  • Select an option

  • Save FlyingThunder/0d5845fea38e19dbe571600c95baff95 to your computer and use it in GitHub Desktop.

Select an option

Save FlyingThunder/0d5845fea38e19dbe571600c95baff95 to your computer and use it in GitHub Desktop.
wxcc-widget-test
(() => {
customElements.define("supervisor-control", class extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
const button = document.createElement("button");
button.textContent = "Press Me";
button.style.padding = "10px 20px";
button.style.fontSize = "16px";
button.style.cursor = "pointer";
button.style.backgroundColor = "#3498db";
button.style.color = "white";
button.style.border = "none";
let toggled = false;
button.addEventListener("click", () => {
toggled = !toggled;
button.style.backgroundColor = toggled ? "#e74c3c" : "#3498db";
});
this.shadowRoot.appendChild(button);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment