solve compiling warnings

This commit is contained in:
Mario
2020-07-31 11:27:53 +02:00
parent 440622a66c
commit 4e2b25947d
18 changed files with 76 additions and 83 deletions
-1
View File
@@ -10,7 +10,6 @@
*
* TODO: maybe change this to a "PIN" BlocklyType
*/
import { defineBlocksWithJsonArray } from 'blockly';
import Blockly from 'blockly/core';
import { selectedBoard } from '../helpers/board'
import * as Types from '../helpers/types'
-1
View File
@@ -1,4 +1,3 @@
import { defineBlocksWithJsonArray } from 'blockly';
import Blockly from 'blockly/core';
-2
View File
@@ -1,2 +0,0 @@
import Blockly from 'blockly';
@@ -1,6 +1,5 @@
import * as Blockly from 'blockly/core';
import { getColour } from '../helpers/colour';
import Block from 'blockly'
Blockly.Blocks['sensebox_osem_connection'] = {
@@ -28,8 +27,7 @@ Blockly.Blocks['sensebox_osem_connection'] = {
this.setNextStatement(true, null);
},
onchange: function (e) {
var block = this;
var blocks = block.getDescendants()
//Blockly.Blocks.sensebox.getDescendants = blocks;
},
@@ -54,7 +52,7 @@ Blockly.Blocks['sensebox_osem_connection'] = {
updateShape_: function () {
var extraFieldExist = this.getFieldValue('gps');
var input = this.getFieldValue('type');
if ((input == 'Mobile') && extraFieldExist == null) {
if ((input === 'Mobile') && extraFieldExist === null) {
this.appendValueInput('lat', 'Number')
.appendField(Blockly.Msg.senseBox_gps_lat, 'gps');
this.appendValueInput('lng', 'Number')
@@ -65,7 +63,7 @@ Blockly.Blocks['sensebox_osem_connection'] = {
.appendField(Blockly.Msg.senseBox_gps_timeStamp);
}
if (input == 'Stationary' && extraFieldExist != null) {
if (input === 'Stationary' && extraFieldExist !== null) {
this.removeInput('lat');
this.removeInput('lng');
this.removeInput('altitude');
@@ -98,7 +96,7 @@ Blockly.Blocks['sensebox_send_to_osem'] = {
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) != -1) {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
@@ -111,7 +111,7 @@ Blockly.Blocks['sensebox_sensor_pressure'] = {
init: function () {
var dropdownOptions = [[Blockly.Msg.senseBox_pressure, "Pressure"], [Blockly.Msg.senseBox_temp, "Temperature"], [Blockly.Msg.senseBox_gps_alt, "Altitude"]];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (option) {
var input = (option == 'Pressure') || (option == 'Temperature') || (option == 'Altitude');
var input = (option === 'Pressure') || (option === 'Temperature') || (option === 'Altitude');
this.sourceBlock_.updateShape_(input);
});
this.appendDummyInput()
@@ -132,7 +132,7 @@ Blockly.Blocks['sensebox_sensor_pressure'] = {
*/
domToMutation: function (xmlElement) {
var input = (xmlElement.getAttribute('port'));
(xmlElement.getAttribute('port'));
},
/**
@@ -156,7 +156,7 @@ Blockly.Blocks['sensebox_sensor_pressure'] = {
updateShape_: function () {
var extraFieldExist = this.getFieldValue('referencePressure');
var input = this.getFieldValue('NAME');
if (input == 'Altitude' && extraFieldExist == null) {
if (input === 'Altitude' && extraFieldExist === null) {
this.appendDummyInput('extraField')
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_pressure_referencePressure)
@@ -164,13 +164,13 @@ Blockly.Blocks['sensebox_sensor_pressure'] = {
.appendField(Blockly.Msg.senseBox_pressure_referencePressure_dim);
}
if ((input == 'Pressure' || input == 'Temperature') && extraFieldExist != null) {
if ((input === 'Pressure' || input === 'Temperature') && extraFieldExist !== null) {
this.removeInput('extraField');
}
},
getBlockType: function () {
var input = this.getFieldValue('NAME');
if (input == 'Temperature') {
if (input === 'Temperature') {
return Types.DECIMAL.typeId;
} else {
return Types.LARGE_NUMBER.typeId;
@@ -215,7 +215,7 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
var dropdownOptions = [[Blockly.Msg.senseBox_ultrasonic_port_A, 'A'],
[Blockly.Msg.senseBox_ultrasonic_port_B, 'B'], [Blockly.Msg.senseBox_ultrasonic_port_C, 'C']];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (option) {
var input = (option == 'A') || (option == 'B') || (option == 'C');
var input = (option === 'A') || (option === 'B') || (option === 'C');
this.sourceBlock_.updateShape_(input);
});
@@ -241,7 +241,7 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
* @this Blockly.Block
*/
domToMutation: function (xmlElement) {
var input = (xmlElement.getAttribute('port'));
(xmlElement.getAttribute('port'));
},
/**
@@ -277,6 +277,8 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
this.setFieldValue('5', 'ultrasonic_trigger');
this.setFieldValue('6', 'ultrasonic_echo');
break;
default:
break;
}
},
+1 -1
View File
@@ -1,4 +1,4 @@
import Blockly from 'blockly';