The reason why I use validate is, when I don't choose any value in dropdown, so the default value should be set, but unfortunately it doesn't. The value was undefined when I don't select any value in dropdown!
if(motorValid_ === false) {
motor_ = 0; <----------------------- here because motorValid never got set
}
else {
motor_ = block.getFieldValue("turnMotor_") <--- never gets called
So that block.getFieldValue("turnMotor_") line works well, because of validator.
I can't think the way that just check what's going on when creating the code in Blockly.JavaScript.*.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The reason why I use
validate
is, when I don't choose any value in dropdown, so the default value should be set, but unfortunately it doesn't. The value wasundefined
when I don't select any value in dropdown!So that
block.getFieldValue("turnMotor_")
line works well, because of validator.I can't think the way that
just check what's going on when creating the code in Blockly.JavaScript.*
.Can you explain with any examples?