Change monitor reporting from category and label to opcode

This commit is contained in:
Paul Kaplan 2017-05-22 13:38:29 -04:00
parent e9c48d250b
commit 144a0b349d

View file

@ -278,7 +278,7 @@ class Blocks {
const block = this._blocks[args.id]; const block = this._blocks[args.id];
if (typeof block === 'undefined') return; if (typeof block === 'undefined') return;
let wasMonitored = block.isMonitored; const wasMonitored = block.isMonitored;
switch (args.element) { switch (args.element) {
case 'field': case 'field':
// Update block value // Update block value
@ -293,22 +293,17 @@ class Blocks {
if (optRuntime && wasMonitored && !block.isMonitored) { if (optRuntime && wasMonitored && !block.isMonitored) {
optRuntime.requestRemoveMonitor(block.id); optRuntime.requestRemoveMonitor(block.id);
} else if (optRuntime && !wasMonitored && block.isMonitored) { } else if (optRuntime && !wasMonitored && block.isMonitored) {
optRuntime.requestAddMonitor( optRuntime.requestAddMonitor({
// Ensure that value is not undefined, since React requires it
{
// @todo(vm#564) this will collide if multiple sprites use same block // @todo(vm#564) this will collide if multiple sprites use same block
id: block.id, id: block.id,
category: 'data', opcode: block.opcode,
// @todo(vm#565) how to handle translation here?
label: block.opcode,
// @todo(vm#565) for numerical values with decimals, some countries use comma // @todo(vm#565) for numerical values with decimals, some countries use comma
value: '', value: '',
x: 0,
// @todo(vm#566) Don't require sending x and y when instantiating a // @todo(vm#566) Don't require sending x and y when instantiating a
// monitor. If it's not preset the GUI should decide. // monitor. If it's not preset the GUI should decide.
x: 0,
y: 0 y: 0
} });
);
} }
break; break;
} }