iobroker.javascript 8.5.0 → 8.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -10
- package/admin/asset-manifest.json +7 -7
- package/admin/google-blockly/own/blocks_action.js +29 -30
- package/admin/google-blockly/own/blocks_convert.js +6 -7
- package/admin/google-blockly/own/blocks_logic.js +16 -16
- package/admin/google-blockly/own/blocks_number.js +2 -2
- package/admin/google-blockly/own/blocks_object.js +14 -15
- package/admin/google-blockly/own/blocks_procedures.js +10 -10
- package/admin/google-blockly/own/blocks_sendto.js +104 -119
- package/admin/google-blockly/own/blocks_switch.js +8 -8
- package/admin/google-blockly/own/blocks_system.js +66 -67
- package/admin/google-blockly/own/blocks_text.js +2 -2
- package/admin/google-blockly/own/blocks_time.js +36 -37
- package/admin/google-blockly/own/blocks_timeout.js +20 -21
- package/admin/google-blockly/own/blocks_trigger.js +67 -68
- package/admin/google-blockly/own/field_cron.js +0 -1
- package/admin/google-blockly/own/field_oid.js +0 -1
- package/admin/google-blockly/own/field_script.js +4 -9
- package/admin/static/js/373.50668df1.chunk.js +2 -0
- package/admin/static/js/373.50668df1.chunk.js.map +1 -0
- package/admin/static/js/373.bf884cc8.chunk.js +2 -0
- package/admin/static/js/373.bf884cc8.chunk.js.map +1 -0
- package/admin/static/js/{974.3b53607f.chunk.js → 974.5c28e487.chunk.js} +3 -3
- package/admin/static/js/{974.3b53607f.chunk.js.map → 974.5c28e487.chunk.js.map} +1 -1
- package/admin/static/js/{main.63c641fd.js → main.524b166f.js} +2 -2
- package/admin/static/js/{main.63c641fd.js.map → main.524b166f.js.map} +1 -1
- package/admin/static/js/main.720010c8.js +2 -0
- package/admin/static/js/main.720010c8.js.map +1 -0
- package/admin/static/js/{main.d6499dc8.js → main.c18bdbeb.js} +2 -2
- package/admin/static/js/{main.d6499dc8.js.map → main.c18bdbeb.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/io-package.json +14 -14
- package/package.json +1 -1
- package/admin/static/js/373.242b04f6.chunk.js +0 -2
- package/admin/static/js/373.242b04f6.chunk.js.map +0 -1
- /package/admin/static/js/{974.3b53607f.chunk.js.LICENSE.txt → 974.5c28e487.chunk.js.LICENSE.txt} +0 -0
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
if (typeof goog !== 'undefined') {
|
|
4
4
|
goog.provide('Blockly.JavaScript.Time');
|
|
5
|
-
|
|
6
5
|
goog.require('Blockly.JavaScript');
|
|
7
6
|
}
|
|
8
7
|
|
|
@@ -30,7 +29,7 @@ Blockly.Time.blocks['time_compare_ex'] =
|
|
|
30
29
|
'</block>';
|
|
31
30
|
|
|
32
31
|
Blockly.Blocks['time_compare_ex'] = {
|
|
33
|
-
init: function() {
|
|
32
|
+
init: function () {
|
|
34
33
|
this.appendDummyInput('TIME_TEXT')
|
|
35
34
|
.appendField(Blockly.Translate('time_compare_ex'));
|
|
36
35
|
|
|
@@ -50,7 +49,7 @@ Blockly.Blocks['time_compare_ex'] = {
|
|
|
50
49
|
[Blockly.Translate('time_compare_ge'), '>='],
|
|
51
50
|
[Blockly.Translate('time_compare_eq'), '=='],
|
|
52
51
|
[Blockly.Translate('time_compare_bw'), 'between'],
|
|
53
|
-
[Blockly.Translate('time_compare_nb'), 'not between']
|
|
52
|
+
[Blockly.Translate('time_compare_nb'), 'not between'],
|
|
54
53
|
], function (option) {
|
|
55
54
|
this.sourceBlock_.updateShape_((option === 'between' || option === 'not between'));
|
|
56
55
|
}), 'OPTION');
|
|
@@ -70,7 +69,7 @@ Blockly.Blocks['time_compare_ex'] = {
|
|
|
70
69
|
this.setTooltip(Blockly.Translate('time_compare_ex_tooltip'));
|
|
71
70
|
this.setHelpUrl(getHelp('time_compare_ex_help'));
|
|
72
71
|
},
|
|
73
|
-
mutationToDom: function() {
|
|
72
|
+
mutationToDom: function () {
|
|
74
73
|
const container = document.createElement('mutation');
|
|
75
74
|
const option = this.getFieldValue('OPTION');
|
|
76
75
|
const use_actual_time = this.getFieldValue('USE_ACTUAL_TIME');
|
|
@@ -78,12 +77,12 @@ Blockly.Blocks['time_compare_ex'] = {
|
|
|
78
77
|
container.setAttribute('actual_time', use_actual_time === 'TRUE' || use_actual_time === 'true' || use_actual_time === true ? 'true' : 'false');
|
|
79
78
|
return container;
|
|
80
79
|
},
|
|
81
|
-
domToMutation: function(xmlElement) {
|
|
80
|
+
domToMutation: function (xmlElement) {
|
|
82
81
|
const end_time = xmlElement.getAttribute('end_time');
|
|
83
82
|
const actual_time = xmlElement.getAttribute('actual_time');
|
|
84
83
|
this.updateShape_(end_time === true || end_time === 'true' || end_time === 'TRUE', actual_time === true || actual_time === 'true' || actual_time === 'TRUE');
|
|
85
84
|
},
|
|
86
|
-
updateShape_: function(isBetween, useActualTime) {
|
|
85
|
+
updateShape_: function (isBetween, useActualTime) {
|
|
87
86
|
if (isBetween === undefined) {
|
|
88
87
|
isBetween = this.getFieldValue('OPTION') === 'between' || this.getFieldValue('OPTION') === 'not between';
|
|
89
88
|
}
|
|
@@ -152,7 +151,7 @@ Blockly.Blocks['time_compare_ex'] = {
|
|
|
152
151
|
},
|
|
153
152
|
};
|
|
154
153
|
|
|
155
|
-
Blockly.JavaScript.forBlock['time_compare_ex'] = function(block) {
|
|
154
|
+
Blockly.JavaScript.forBlock['time_compare_ex'] = function (block) {
|
|
156
155
|
const option = block.getFieldValue('OPTION');
|
|
157
156
|
const start_time = Blockly.JavaScript.valueToCode(block, 'START_TIME', Blockly.JavaScript.ORDER_ATOMIC);
|
|
158
157
|
let end_time = Blockly.JavaScript.valueToCode(block, 'END_TIME', Blockly.JavaScript.ORDER_ATOMIC);
|
|
@@ -173,7 +172,7 @@ Blockly.Time.blocks['time_compare'] =
|
|
|
173
172
|
'</block>';
|
|
174
173
|
|
|
175
174
|
Blockly.Blocks['time_compare'] = {
|
|
176
|
-
init: function() {
|
|
175
|
+
init: function () {
|
|
177
176
|
this.appendDummyInput()
|
|
178
177
|
.appendField(Blockly.Translate('time_compare'));
|
|
179
178
|
|
|
@@ -207,17 +206,17 @@ Blockly.Blocks['time_compare'] = {
|
|
|
207
206
|
this.setHelpUrl(getHelp('time_compare_help'));
|
|
208
207
|
},
|
|
209
208
|
|
|
210
|
-
mutationToDom: function() {
|
|
209
|
+
mutationToDom: function () {
|
|
211
210
|
const container = document.createElement('mutation');
|
|
212
211
|
const option = this.getFieldValue('OPTION');
|
|
213
212
|
container.setAttribute('end_time', (option === 'between' || option === 'not between') ? 'true' : 'false');
|
|
214
213
|
return container;
|
|
215
214
|
},
|
|
216
|
-
domToMutation: function(xmlElement) {
|
|
215
|
+
domToMutation: function (xmlElement) {
|
|
217
216
|
const option = xmlElement.getAttribute('end_time');
|
|
218
217
|
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
|
|
219
218
|
},
|
|
220
|
-
updateShape_: function(isBetween) {
|
|
219
|
+
updateShape_: function (isBetween) {
|
|
221
220
|
// Add or remove a delay Input.
|
|
222
221
|
const inputExists = this.getInput('END_TIME');
|
|
223
222
|
|
|
@@ -236,7 +235,7 @@ Blockly.Blocks['time_compare'] = {
|
|
|
236
235
|
},
|
|
237
236
|
};
|
|
238
237
|
|
|
239
|
-
Blockly.JavaScript.forBlock['time_compare'] = function(block) {
|
|
238
|
+
Blockly.JavaScript.forBlock['time_compare'] = function (block) {
|
|
240
239
|
const option = block.getFieldValue('OPTION');
|
|
241
240
|
const start_time = block.getFieldValue('START_TIME');
|
|
242
241
|
let end_time = block.getFieldValue('END_TIME');
|
|
@@ -271,7 +270,7 @@ Blockly.Time.blocks['time_get'] =
|
|
|
271
270
|
'</block>';
|
|
272
271
|
|
|
273
272
|
Blockly.Blocks['time_get'] = {
|
|
274
|
-
init: function() {
|
|
273
|
+
init: function () {
|
|
275
274
|
this.appendDummyInput()
|
|
276
275
|
.appendField(Blockly.Translate('time_get'));
|
|
277
276
|
|
|
@@ -324,19 +323,19 @@ Blockly.Blocks['time_get'] = {
|
|
|
324
323
|
this.setTooltip(Blockly.Translate('time_get_tooltip'));
|
|
325
324
|
//this.setHelpUrl(getHelp('time_get_help'));
|
|
326
325
|
},
|
|
327
|
-
mutationToDom: function() {
|
|
326
|
+
mutationToDom: function () {
|
|
328
327
|
const container = document.createElement('mutation');
|
|
329
328
|
const option = this.getFieldValue('OPTION');
|
|
330
329
|
container.setAttribute('format', option === 'custom' ? 'true' : 'false');
|
|
331
330
|
container.setAttribute('language', option === 'wdt' || option === 'wdts' || option === 'Mt' || option === 'Mts' ? 'true' : 'false');
|
|
332
331
|
return container;
|
|
333
332
|
},
|
|
334
|
-
domToMutation: function(xmlElement) {
|
|
333
|
+
domToMutation: function (xmlElement) {
|
|
335
334
|
const format = xmlElement.getAttribute('format');
|
|
336
335
|
const language = xmlElement.getAttribute('language');
|
|
337
336
|
this.updateShape_(format === true || format === 'true' || format === 'TRUE', language === true || language === 'true' || language === 'TRUE');
|
|
338
337
|
},
|
|
339
|
-
updateShape_: function(isFormat, isLanguage) {
|
|
338
|
+
updateShape_: function (isFormat, isLanguage) {
|
|
340
339
|
// Add or remove a delay Input.
|
|
341
340
|
let inputExists = this.getInput('FORMAT');
|
|
342
341
|
|
|
@@ -373,7 +372,7 @@ Blockly.Blocks['time_get'] = {
|
|
|
373
372
|
},
|
|
374
373
|
};
|
|
375
374
|
|
|
376
|
-
Blockly.JavaScript.forBlock['time_get'] = function(block) {
|
|
375
|
+
Blockly.JavaScript.forBlock['time_get'] = function (block) {
|
|
377
376
|
const option = block.getFieldValue('OPTION');
|
|
378
377
|
const format = block.getFieldValue('FORMAT');
|
|
379
378
|
const lang = block.getFieldValue('LANGUAGE');
|
|
@@ -429,7 +428,7 @@ Blockly.Time.blocks['time_get_special'] =
|
|
|
429
428
|
'</block>';
|
|
430
429
|
|
|
431
430
|
Blockly.Blocks['time_get_special'] = {
|
|
432
|
-
init: function() {
|
|
431
|
+
init: function () {
|
|
433
432
|
this.appendDummyInput()
|
|
434
433
|
.appendField(Blockly.Translate('time_get_special'));
|
|
435
434
|
|
|
@@ -453,7 +452,7 @@ Blockly.Blocks['time_get_special'] = {
|
|
|
453
452
|
},
|
|
454
453
|
};
|
|
455
454
|
|
|
456
|
-
Blockly.JavaScript.forBlock['time_get_special'] = function(block) {
|
|
455
|
+
Blockly.JavaScript.forBlock['time_get_special'] = function (block) {
|
|
457
456
|
const type = block.getFieldValue('TYPE');
|
|
458
457
|
|
|
459
458
|
let code;
|
|
@@ -482,26 +481,26 @@ Blockly.Time.blocks['time_astro'] =
|
|
|
482
481
|
'</block>';
|
|
483
482
|
|
|
484
483
|
Blockly.Blocks['time_astro'] = {
|
|
485
|
-
init: function() {
|
|
484
|
+
init: function () {
|
|
486
485
|
this.appendDummyInput()
|
|
487
486
|
.appendField(Blockly.Translate('time_astro'));
|
|
488
487
|
|
|
489
488
|
this.appendDummyInput('TYPE')
|
|
490
489
|
.appendField(new Blockly.FieldDropdown([
|
|
491
|
-
[Blockly.Translate('astro_sunriseText'),
|
|
492
|
-
[Blockly.Translate('astro_sunriseEndText'),
|
|
493
|
-
[Blockly.Translate('astro_goldenHourEndText'),
|
|
494
|
-
[Blockly.Translate('astro_solarNoonText'),
|
|
495
|
-
[Blockly.Translate('astro_goldenHourText'),
|
|
496
|
-
[Blockly.Translate('astro_sunsetStartText'),
|
|
497
|
-
[Blockly.Translate('astro_sunsetText'),
|
|
498
|
-
[Blockly.Translate('astro_duskText'),
|
|
499
|
-
[Blockly.Translate('astro_nauticalDuskText'),
|
|
500
|
-
[Blockly.Translate('astro_nightText'),
|
|
501
|
-
[Blockly.Translate('astro_nightEndText'),
|
|
502
|
-
[Blockly.Translate('astro_nauticalDawnText'),
|
|
503
|
-
[Blockly.Translate('astro_dawnText'),
|
|
504
|
-
[Blockly.Translate('astro_nadirText'),
|
|
490
|
+
[Blockly.Translate('astro_sunriseText'), 'sunrise'],
|
|
491
|
+
[Blockly.Translate('astro_sunriseEndText'), 'sunriseEnd'],
|
|
492
|
+
[Blockly.Translate('astro_goldenHourEndText'), 'goldenHourEnd'],
|
|
493
|
+
[Blockly.Translate('astro_solarNoonText'), 'solarNoon'],
|
|
494
|
+
[Blockly.Translate('astro_goldenHourText'), 'goldenHour'],
|
|
495
|
+
[Blockly.Translate('astro_sunsetStartText'), 'sunsetStart'],
|
|
496
|
+
[Blockly.Translate('astro_sunsetText'), 'sunset'],
|
|
497
|
+
[Blockly.Translate('astro_duskText'), 'dusk'],
|
|
498
|
+
[Blockly.Translate('astro_nauticalDuskText'), 'nauticalDusk'],
|
|
499
|
+
[Blockly.Translate('astro_nightText'), 'night'],
|
|
500
|
+
[Blockly.Translate('astro_nightEndText'), 'nightEnd'],
|
|
501
|
+
[Blockly.Translate('astro_nauticalDawnText'), 'nauticalDawn'],
|
|
502
|
+
[Blockly.Translate('astro_dawnText'), 'dawn'],
|
|
503
|
+
[Blockly.Translate('astro_nadirText'), 'nadir'],
|
|
505
504
|
]), 'TYPE');
|
|
506
505
|
|
|
507
506
|
this.appendDummyInput('OFFSET')
|
|
@@ -518,7 +517,7 @@ Blockly.Blocks['time_astro'] = {
|
|
|
518
517
|
}
|
|
519
518
|
};
|
|
520
519
|
|
|
521
|
-
Blockly.JavaScript.forBlock['time_astro'] = function(block) {
|
|
520
|
+
Blockly.JavaScript.forBlock['time_astro'] = function (block) {
|
|
522
521
|
const type = block.getFieldValue('TYPE');
|
|
523
522
|
const offset = parseFloat(block.getFieldValue('OFFSET'));
|
|
524
523
|
|
|
@@ -544,7 +543,7 @@ Blockly.Time.blocks['time_calculation'] =
|
|
|
544
543
|
'</block>';
|
|
545
544
|
|
|
546
545
|
Blockly.Blocks['time_calculation'] = {
|
|
547
|
-
init: function() {
|
|
546
|
+
init: function () {
|
|
548
547
|
this.appendDummyInput('NAME')
|
|
549
548
|
.appendField(Blockly.Translate('time_calculation'));
|
|
550
549
|
|
|
@@ -580,7 +579,7 @@ Blockly.Blocks['time_calculation'] = {
|
|
|
580
579
|
},
|
|
581
580
|
};
|
|
582
581
|
|
|
583
|
-
Blockly.JavaScript.forBlock['time_calculation'] = function(block) {
|
|
582
|
+
Blockly.JavaScript.forBlock['time_calculation'] = function (block) {
|
|
584
583
|
const dateTime = Blockly.JavaScript.valueToCode(block, 'DATE_TIME', Blockly.JavaScript.ORDER_ATOMIC);
|
|
585
584
|
const operation = block.getFieldValue('OPERATION');
|
|
586
585
|
const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
if (typeof goog !== 'undefined') {
|
|
4
4
|
goog.provide('Blockly.JavaScript.Timeouts');
|
|
5
|
-
|
|
6
5
|
goog.require('Blockly.JavaScript');
|
|
7
6
|
} else {
|
|
8
7
|
// define this object for blockly modules from adapters
|
|
@@ -26,7 +25,7 @@ Blockly.Timeouts = {
|
|
|
26
25
|
* @param {!Blockly.Block} block Block to disambiguate.
|
|
27
26
|
* @return {string} Non-colliding name.
|
|
28
27
|
*/
|
|
29
|
-
Blockly.Timeouts.findLegalName = function(name, block) {
|
|
28
|
+
Blockly.Timeouts.findLegalName = function (name, block) {
|
|
30
29
|
if (block.isInFlyout) {
|
|
31
30
|
// Flyouts can have multiple procedures called 'do something'.
|
|
32
31
|
return name;
|
|
@@ -53,7 +52,7 @@ Blockly.Timeouts.findLegalName = function(name, block) {
|
|
|
53
52
|
* @return {boolean} True if the name is legal.
|
|
54
53
|
* @private
|
|
55
54
|
*/
|
|
56
|
-
Blockly.Timeouts.isLegalName_ = function(name, workspace, opt_exclude) {
|
|
55
|
+
Blockly.Timeouts.isLegalName_ = function (name, workspace, opt_exclude) {
|
|
57
56
|
const blocks = workspace.getAllBlocks();
|
|
58
57
|
// Iterate through every block and check the name.
|
|
59
58
|
for (let i = 0; i < blocks.length; i++) {
|
|
@@ -90,7 +89,7 @@ Blockly.Timeouts.blocks['timeouts_wait'] =
|
|
|
90
89
|
'</block>';
|
|
91
90
|
|
|
92
91
|
Blockly.Blocks['timeouts_wait'] = {
|
|
93
|
-
init: function() {
|
|
92
|
+
init: function () {
|
|
94
93
|
this.appendDummyInput()
|
|
95
94
|
.appendField(Blockly.Translate('timeouts_wait'))
|
|
96
95
|
.appendField(new Blockly.FieldTextInput(1000), "DELAY")
|
|
@@ -109,7 +108,7 @@ Blockly.Blocks['timeouts_wait'] = {
|
|
|
109
108
|
},
|
|
110
109
|
};
|
|
111
110
|
|
|
112
|
-
Blockly.JavaScript.forBlock['timeouts_wait'] = function(block) {
|
|
111
|
+
Blockly.JavaScript.forBlock['timeouts_wait'] = function (block) {
|
|
113
112
|
const unit = block.getFieldValue('UNIT');
|
|
114
113
|
|
|
115
114
|
let delay = block.getFieldValue('DELAY');
|
|
@@ -131,7 +130,7 @@ Blockly.Timeouts.blocks['timeouts_settimeout'] =
|
|
|
131
130
|
'</block>';
|
|
132
131
|
|
|
133
132
|
Blockly.Blocks['timeouts_settimeout'] = {
|
|
134
|
-
init: function() {
|
|
133
|
+
init: function () {
|
|
135
134
|
const nameField = new Blockly.FieldTextInput(Blockly.Timeouts.findLegalName('timeout', this), Blockly.Timeouts.rename);
|
|
136
135
|
|
|
137
136
|
nameField.setSpellcheck(false);
|
|
@@ -168,7 +167,7 @@ Blockly.Blocks['timeouts_settimeout'] = {
|
|
|
168
167
|
},
|
|
169
168
|
};
|
|
170
169
|
|
|
171
|
-
Blockly.JavaScript.forBlock['timeouts_settimeout'] = function(block) {
|
|
170
|
+
Blockly.JavaScript.forBlock['timeouts_settimeout'] = function (block) {
|
|
172
171
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
173
172
|
const unit = block.getFieldValue('UNIT');
|
|
174
173
|
|
|
@@ -197,7 +196,7 @@ Blockly.Timeouts.blocks['timeouts_settimeout_variable'] =
|
|
|
197
196
|
'</block>';
|
|
198
197
|
|
|
199
198
|
Blockly.Blocks['timeouts_settimeout_variable'] = {
|
|
200
|
-
init: function() {
|
|
199
|
+
init: function () {
|
|
201
200
|
const nameField = new Blockly.FieldTextInput(Blockly.Timeouts.findLegalName('timeout', this), Blockly.Timeouts.rename);
|
|
202
201
|
|
|
203
202
|
nameField.setSpellcheck(false);
|
|
@@ -231,7 +230,7 @@ Blockly.Blocks['timeouts_settimeout_variable'] = {
|
|
|
231
230
|
},
|
|
232
231
|
};
|
|
233
232
|
|
|
234
|
-
Blockly.JavaScript.forBlock['timeouts_settimeout_variable'] = function(block) {
|
|
233
|
+
Blockly.JavaScript.forBlock['timeouts_settimeout_variable'] = function (block) {
|
|
235
234
|
const delay = Blockly.JavaScript.valueToCode(block, 'DELAY_MS', Blockly.JavaScript.ORDER_ATOMIC);
|
|
236
235
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
237
236
|
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
|
@@ -274,7 +273,7 @@ Blockly.Timeouts.blocks['timeouts_cleartimeout'] =
|
|
|
274
273
|
'</block>';
|
|
275
274
|
|
|
276
275
|
Blockly.Blocks['timeouts_cleartimeout'] = {
|
|
277
|
-
init: function() {
|
|
276
|
+
init: function () {
|
|
278
277
|
this.appendDummyInput('NAME')
|
|
279
278
|
.appendField(Blockly.Translate('timeouts_cleartimeout'))
|
|
280
279
|
.appendField(new Blockly.FieldDropdown(function () {
|
|
@@ -290,7 +289,7 @@ Blockly.Blocks['timeouts_cleartimeout'] = {
|
|
|
290
289
|
},
|
|
291
290
|
};
|
|
292
291
|
|
|
293
|
-
Blockly.JavaScript.forBlock['timeouts_cleartimeout'] = function(block) {
|
|
292
|
+
Blockly.JavaScript.forBlock['timeouts_cleartimeout'] = function (block) {
|
|
294
293
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
295
294
|
return `(() => { if (${name}) { clearTimeout(${name}); ${name} = null; }})();\n`;
|
|
296
295
|
};
|
|
@@ -302,7 +301,7 @@ Blockly.Timeouts.blocks['timeouts_gettimeout'] =
|
|
|
302
301
|
'</block>';
|
|
303
302
|
|
|
304
303
|
Blockly.Blocks['timeouts_gettimeout'] = {
|
|
305
|
-
init: function() {
|
|
304
|
+
init: function () {
|
|
306
305
|
this.appendDummyInput('NAME')
|
|
307
306
|
.appendField(Blockly.Translate('timeouts_gettimeout'))
|
|
308
307
|
.appendField(new Blockly.FieldDropdown(function () {
|
|
@@ -317,7 +316,7 @@ Blockly.Blocks['timeouts_gettimeout'] = {
|
|
|
317
316
|
},
|
|
318
317
|
};
|
|
319
318
|
|
|
320
|
-
Blockly.JavaScript.forBlock['timeouts_gettimeout'] = function(block) {
|
|
319
|
+
Blockly.JavaScript.forBlock['timeouts_gettimeout'] = function (block) {
|
|
321
320
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
322
321
|
|
|
323
322
|
return [name, Blockly.JavaScript.ORDER_ATOMIC];
|
|
@@ -331,7 +330,7 @@ Blockly.Timeouts.blocks['timeouts_setinterval'] =
|
|
|
331
330
|
'</block>';
|
|
332
331
|
|
|
333
332
|
Blockly.Blocks['timeouts_setinterval'] = {
|
|
334
|
-
init: function() {
|
|
333
|
+
init: function () {
|
|
335
334
|
const nameField = new Blockly.FieldTextInput(Blockly.Timeouts.findLegalName(Blockly.Translate('timeouts_setinterval_name'), this), Blockly.Timeouts.rename);
|
|
336
335
|
|
|
337
336
|
nameField.setSpellcheck(false);
|
|
@@ -368,7 +367,7 @@ Blockly.Blocks['timeouts_setinterval'] = {
|
|
|
368
367
|
},
|
|
369
368
|
};
|
|
370
369
|
|
|
371
|
-
Blockly.JavaScript.forBlock['timeouts_setinterval'] = function(block) {
|
|
370
|
+
Blockly.JavaScript.forBlock['timeouts_setinterval'] = function (block) {
|
|
372
371
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
373
372
|
const unit = block.getFieldValue('UNIT');
|
|
374
373
|
|
|
@@ -396,7 +395,7 @@ Blockly.Timeouts.blocks['timeouts_setinterval_variable'] =
|
|
|
396
395
|
'</block>';
|
|
397
396
|
|
|
398
397
|
Blockly.Blocks['timeouts_setinterval_variable'] = {
|
|
399
|
-
init: function() {
|
|
398
|
+
init: function () {
|
|
400
399
|
const nameField = new Blockly.FieldTextInput(
|
|
401
400
|
Blockly.Timeouts.findLegalName(Blockly.Translate('timeouts_setinterval_name'), this),
|
|
402
401
|
Blockly.Timeouts.rename);
|
|
@@ -432,7 +431,7 @@ Blockly.Blocks['timeouts_setinterval_variable'] = {
|
|
|
432
431
|
},
|
|
433
432
|
};
|
|
434
433
|
|
|
435
|
-
Blockly.JavaScript.forBlock['timeouts_setinterval_variable'] = function(block) {
|
|
434
|
+
Blockly.JavaScript.forBlock['timeouts_setinterval_variable'] = function (block) {
|
|
436
435
|
const delay = Blockly.JavaScript.valueToCode(block, 'INTERVAL_MS', Blockly.JavaScript.ORDER_ATOMIC);
|
|
437
436
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
438
437
|
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
|
@@ -474,7 +473,7 @@ Blockly.Timeouts.getAllIntervals = function (workspace) {
|
|
|
474
473
|
};
|
|
475
474
|
|
|
476
475
|
Blockly.Blocks['timeouts_clearinterval'] = {
|
|
477
|
-
init: function() {
|
|
476
|
+
init: function () {
|
|
478
477
|
this.appendDummyInput("NAME")
|
|
479
478
|
.appendField(Blockly.Translate('timeouts_clearinterval'))
|
|
480
479
|
.appendField(new Blockly.FieldDropdown(function () {
|
|
@@ -490,7 +489,7 @@ Blockly.Blocks['timeouts_clearinterval'] = {
|
|
|
490
489
|
},
|
|
491
490
|
};
|
|
492
491
|
|
|
493
|
-
Blockly.JavaScript.forBlock['timeouts_clearinterval'] = function(block) {
|
|
492
|
+
Blockly.JavaScript.forBlock['timeouts_clearinterval'] = function (block) {
|
|
494
493
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
495
494
|
|
|
496
495
|
return `(() => { if (${name}) { clearInterval(${name}); ${name} = null; }})();\n`;
|
|
@@ -503,7 +502,7 @@ Blockly.Timeouts.blocks['timeouts_getinterval'] =
|
|
|
503
502
|
'</block>';
|
|
504
503
|
|
|
505
504
|
Blockly.Blocks['timeouts_getinterval'] = {
|
|
506
|
-
init: function() {
|
|
505
|
+
init: function () {
|
|
507
506
|
this.appendDummyInput("NAME")
|
|
508
507
|
.appendField(Blockly.Translate('timeouts_getinterval'))
|
|
509
508
|
.appendField(new Blockly.FieldDropdown(function () {
|
|
@@ -518,7 +517,7 @@ Blockly.Blocks['timeouts_getinterval'] = {
|
|
|
518
517
|
},
|
|
519
518
|
};
|
|
520
519
|
|
|
521
|
-
Blockly.JavaScript.forBlock['timeouts_getinterval'] = function(block) {
|
|
520
|
+
Blockly.JavaScript.forBlock['timeouts_getinterval'] = function (block) {
|
|
522
521
|
const name = Blockly.JavaScript.nameDB_.safeName(block.getFieldValue('NAME'));
|
|
523
522
|
|
|
524
523
|
return [name, Blockly.JavaScript.ORDER_ATOMIC];
|