mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -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) {
|
||||
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];
|
||||
if (this.runtime) {
|
||||
if (variable.isCloud && this.isStage) {
|
||||
this.runtime.ioDevices.cloud.requestDeleteVariable(variable.name);
|
||||
if (deletedVariableWasCloud && this.isStage) {
|
||||
this.runtime.ioDevices.cloud.requestDeleteVariable(deletedVariableName);
|
||||
}
|
||||
this.runtime.monitorBlocks.deleteBlock(id);
|
||||
this.runtime.requestRemoveMonitor(id);
|
||||
|
|
Loading…
Reference in a new issue