This commit is contained in:
DD Liu 2017-07-11 11:51:47 -04:00
parent 7f1f9079e3
commit 4b1307bb11

View file

@ -162,17 +162,21 @@ class Target extends EventEmitter {
const variable = this.variables[id];
if (variable.id === id) {
variable.name = newName;
const blocks = this.runtime.monitorBlocks;
blocks.changeBlock({
id: id,
element: 'field',
name: 'VARIABLE',
value: newName
}, this.runtime);
this.runtime.requestUpdateMonitor(Map({
id: id,
params: blocks._getBlockParams(blocks.getBlock(variable.id))
}));
if (this.runtime) {
const blocks = this.runtime.monitorBlocks;
blocks.changeBlock({
id: id,
element: 'field',
name: 'VARIABLE',
value: newName
}, this.runtime);
this.runtime.requestUpdateMonitor(Map({
id: id,
params: blocks._getBlockParams(blocks.getBlock(variable.id))
}));
}
}
}
}
@ -184,7 +188,9 @@ class Target extends EventEmitter {
deleteVariable (id) {
if (this.variables.hasOwnProperty(id)) {
delete this.variables[id];
this.runtime.requestRemoveMonitor(id);
if (this.runtime) {
this.runtime.requestRemoveMonitor(id);
}
}
}