5
5
*/
6
6
export default function ( Generator ) {
7
7
Generator . wedo2_menu_MOTOR_ID = function ( block ) {
8
- const motor_id = Generator . quote_ ( Generator . getFieldValue ( block , 'MOTOR_ID' ) || 'motor' ) ;
9
- return [ motor_id , Generator . ORDER_ATOMIC ]
8
+ const motorId = Generator . quote_ ( Generator . getFieldValue ( block , 'MOTOR_ID' ) || 'motor' ) ;
9
+ return [ motorId , Generator . ORDER_ATOMIC ] ;
10
10
} ;
11
11
Generator . wedo2_motorOnFor = function ( block ) {
12
- const motor_id = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
12
+ const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
13
13
const duration = Generator . valueToCode ( block , 'DURATION' , Generator . ORDER_NONE ) || null ;
14
- return `wedo2_turn_motor_on_for(${ motor_id } , ${ duration } )\n` ;
14
+ return `wedo2_turn_motor_on_for(${ motorId } , ${ duration } )\n` ;
15
15
} ;
16
16
17
17
Generator . wedo2_motorOn = function ( block ) {
18
- const motor_id = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
19
- return `wedo2_trun_motor_on(${ motor_id } )\n` ;
18
+ const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
19
+ return `wedo2_trun_motor_on(${ motorId } )\n` ;
20
20
} ;
21
21
22
22
Generator . wedo2_motorOff = function ( block ) {
23
- const motor_id = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
24
- return `wedo2_trun_motor_off(${ motor_id } )\n` ;
23
+ const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
24
+ return `wedo2_trun_motor_off(${ motorId } )\n` ;
25
25
} ;
26
26
27
27
Generator . wedo2_startMotorPower = function ( block ) {
28
- const motor_id = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
29
- const power = Generator . valueToCode ( block , 'POWER' , Generator . ORDER_NONE ) || null ;
30
- return `wedo2_set_motor_power(${ motor_id } , ${ power } )\n` ;
28
+ const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
29
+ const power = Generator . valueToCode ( block , 'POWER' , Generator . ORDER_NONE ) || null ;
30
+ return `wedo2_set_motor_power(${ motorId } , ${ power } )\n` ;
31
31
} ;
32
32
33
33
Generator . wedo2_menu_MOTOR_DIRECTION = function ( block ) {
34
- const motor_direction = Generator . quote_ ( Generator . getFieldValue ( block , 'MOTOR_DIRECTION' ) || 'this way' ) ;
35
- return [ motor_direction , Generator . ORDER_ATOMIC ] ;
34
+ const motorDirection = Generator . quote_ ( Generator . getFieldValue ( block , 'MOTOR_DIRECTION' ) || 'this way' ) ;
35
+ return [ motorDirection , Generator . ORDER_ATOMIC ] ;
36
36
} ;
37
37
38
38
Generator . wedo2_setMotorDirection = function ( block ) {
39
- const motor_id = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
40
- const motor_direction = Generator . valueToCode ( block , 'MOTOR_DIRECTION' , Generator . ORDER_NONE ) || null ;
41
- return `wedo2_set_motor_direction(${ motor_id } , ${ motor_direction } )\n` ;
39
+ const motorId = Generator . valueToCode ( block , 'MOTOR_ID' , Generator . ORDER_NONE ) || null ;
40
+ const motorDirection = Generator . valueToCode ( block , 'MOTOR_DIRECTION' , Generator . ORDER_NONE ) || null ;
41
+ return `wedo2_set_motor_direction(${ motorId } , ${ motorDirection } )\n` ;
42
42
} ;
43
43
44
44
Generator . wedo2_setLightHue = function ( block ) {
@@ -59,34 +59,34 @@ export default function (Generator) {
59
59
} ;
60
60
61
61
Generator . wedo2_menu_TILT_DIRECTION_ANY = function ( block ) {
62
- const tilt_direction_any = Generator . quote_ ( Generator . getFieldValue ( block , 'TILT_DIRECTION_ANY' ) || 'any' ) ;
63
- return [ tilt_direction_any , Generator . ORDER_ATOMIC ] ;
62
+ const tiltDirectionAny = Generator . quote_ ( Generator . getFieldValue ( block , 'TILT_DIRECTION_ANY' ) || 'any' ) ;
63
+ return [ tiltDirectionAny , Generator . ORDER_ATOMIC ] ;
64
64
} ;
65
65
66
66
Generator . wedo2_whenTilted = function ( block ) {
67
67
block . isStatement = true ;
68
- const tilt_direction_any = Generator . valueToCode ( block , 'TILT_DIRECTION_ANY' , Generator . ORDER_NONE ) || null ;
69
- return `wedo2_when_tilted(${ tilt_direction_any } ) do\n` ;
68
+ const tiltDirectionAny = Generator . valueToCode ( block , 'TILT_DIRECTION_ANY' , Generator . ORDER_NONE ) || null ;
69
+ return `wedo2_when_tilted(${ tiltDirectionAny } ) do\n` ;
70
70
} ;
71
71
72
- Generator . wedo2_getDistance = function ( block ) {
72
+ Generator . wedo2_getDistance = function ( ) {
73
73
return [ `wedo2_distance` , Generator . ORDER_ATOMIC ] ;
74
74
} ;
75
75
76
76
Generator . wedo2_isTilted = function ( block ) {
77
- const tilt_direction_any = Generator . valueToCode ( block , 'TILT_DIRECTION_ANY' , Generator . ORDER_NONE ) || null ;
78
- return `wedo2_tilted(${ tilt_direction_any } )\n` ;
77
+ const tiltDirectionAny = Generator . valueToCode ( block , 'TILT_DIRECTION_ANY' , Generator . ORDER_NONE ) || null ;
78
+ return `wedo2_tilted(${ tiltDirectionAny } )\n` ;
79
79
} ;
80
80
81
81
Generator . wedo2_menu_TILT_DIRECTION = function ( block ) {
82
- const tilt_direction = Generator . quote_ ( Generator . getFieldValue ( block , 'TILT_DIRECTION' ) || 'up' ) ;
83
- return [ tilt_direction , Generator . ORDER_ATOMIC ] ;
82
+ const tiltDirection = Generator . quote_ ( Generator . getFieldValue ( block , 'TILT_DIRECTION' ) || 'up' ) ;
83
+ return [ tiltDirection , Generator . ORDER_ATOMIC ] ;
84
84
} ;
85
85
86
86
Generator . wedo2_getTiltAngle = function ( block ) {
87
- const tilt_direction = Generator . valueToCode ( block , 'TILT_DIRECTION' , Generator . ORDER_NONE ) || null ;
88
- return [ `wedo2_tilt_angle(${ tilt_direction } )` , Generator . ORDER_ATOMIC ] ;
89
- } ;
87
+ const tiltDirection = Generator . valueToCode ( block , 'TILT_DIRECTION' , Generator . ORDER_NONE ) || null ;
88
+ return [ `wedo2_tilt_angle(${ tiltDirection } )` , Generator . ORDER_ATOMIC ] ;
89
+ } ;
90
90
91
91
return Generator ;
92
92
}
0 commit comments