Switch
The object that describes how to configure a switch simulation primitive.
x
const mySwitch = flux.controls.find(control => control.name === "Switch");
if (mySwitch.value) {
flux.currentSymbol = "closed";
flux.simulationModel = {type: "switch", state: true};
} else {
flux.currentSymbol = "open";
flux.simulationModel = {type: "switch", state: false};
}
flux.on("inputChange", (e) => {
if (e.control_name === "Switch") {
if (e.value) {
flux.currentSymbol = "closed";
flux.simulationModel = {type: "switch", state: true};
} else {
flux.currentSymbol = "open";
flux.simulationModel = {type: "switch", state: false};
}
}
});
Was this page helpful?