mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Replace reference to deleted variable with specific variable info needed.
This commit is contained in:
parent
abbce00203
commit
63c4b53b09
1 changed files with 5 additions and 3 deletions
|
@ -319,11 +319,13 @@ class Target extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
deleteVariable (id) {
|
deleteVariable (id) {
|
||||||
if (this.variables.hasOwnProperty(id)) {
|
if (this.variables.hasOwnProperty(id)) {
|
||||||
const variable = this.variables[id];
|
// Get info about the variable before deleting it
|
||||||
|
const deletedVariableName = this.variables[id].name;
|
||||||
|
const deletedVariableWasCloud = this.variables[id].isCloud;
|
||||||
delete this.variables[id];
|
delete this.variables[id];
|
||||||
if (this.runtime) {
|
if (this.runtime) {
|
||||||
if (variable.isCloud && this.isStage) {
|
if (deletedVariableWasCloud && this.isStage) {
|
||||||
this.runtime.ioDevices.cloud.requestDeleteVariable(variable.name);
|
this.runtime.ioDevices.cloud.requestDeleteVariable(deletedVariableName);
|
||||||
}
|
}
|
||||||
this.runtime.monitorBlocks.deleteBlock(id);
|
this.runtime.monitorBlocks.deleteBlock(id);
|
||||||
this.runtime.requestRemoveMonitor(id);
|
this.runtime.requestRemoveMonitor(id);
|
||||||
|
|
Loading…
Reference in a new issue