22 lines
516 B
JavaScript
22 lines
516 B
JavaScript
class Switch extends Base {
|
|
getContainer() {
|
|
const entity = super.getContainer();
|
|
entity.onclick = () => {
|
|
this.mm.sendSocketNotification("TOGGLE_STATE", { entity: this.id });
|
|
};
|
|
entity.ontouchend = () => {
|
|
this.mm.sendSocketNotification("TOGGLE_STATE", { entity: this.id });
|
|
}
|
|
|
|
return entity;
|
|
}
|
|
|
|
render() {
|
|
super.render();
|
|
const container = document.getElementById(this.id);
|
|
container.classList.add(this.state)
|
|
|
|
container.appendChild(statusCheckbox);
|
|
}
|
|
}
|