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
{ id: block.id,
// @todo(vm#564) this will collide if multiple sprites use same block opcode: block.opcode,
id: block.id, // @todo(vm#565) for numerical values with decimals, some countries use comma
category: 'data', value: '',
// @todo(vm#565) how to handle translation here? // @todo(vm#566) Don't require sending x and y when instantiating a
label: block.opcode, // monitor. If it's not preset the GUI should decide.
// @todo(vm#565) for numerical values with decimals, some countries use comma x: 0,
value: '', y: 0
x: 0, });
// @todo(vm#566) Don't require sending x and y when instantiating a
// monitor. If it's not preset the GUI should decide.
y: 0
}
);
} }
break; break;
} }
@ -370,7 +365,7 @@ class Blocks {
} }
} }
/** /**
* Block management: run all blocks. * Block management: run all blocks.
* @param {!object} runtime Runtime to run all blocks in. * @param {!object} runtime Runtime to run all blocks in.