Fix event related missing requires (#4656)

* Fix event related missing requires
This commit is contained in:
Sam El-Husseini
2021-02-25 17:28:11 -05:00
committed by GitHub
parent d42afc7e69
commit ab8a11784d
37 changed files with 116 additions and 71 deletions

View File

@@ -106,7 +106,8 @@ Blockly.VariableMap.prototype.renameVariableById = function(id, newName) {
*/
Blockly.VariableMap.prototype.renameVariableAndUses_ = function(variable,
newName, blocks) {
Blockly.Events.fire(new Blockly.Events.VarRename(variable, newName));
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_RENAME))(
variable, newName));
variable.name = newName;
for (var i = 0; i < blocks.length; i++) {
blocks[i].updateVarName(variable);
@@ -143,7 +144,8 @@ Blockly.VariableMap.prototype.renameVariableWithConflict_ = function(variable,
}
// Finally delete the original variable, which is now unreferenced.
Blockly.Events.fire(new Blockly.Events.VarDelete(variable));
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_DELETE))(
variable));
// And remove it from the list.
var variableList = this.getVariablesOfType(type);
var variableIndex = variableList.indexOf(variable);
@@ -205,7 +207,8 @@ Blockly.VariableMap.prototype.deleteVariable = function(variable) {
for (var i = 0, tempVar; (tempVar = variableList[i]); i++) {
if (tempVar.getId() == variable.getId()) {
variableList.splice(i, 1);
Blockly.Events.fire(new Blockly.Events.VarDelete(variable));
Blockly.Events.fire(new (Blockly.Events.get(Blockly.Events.VAR_DELETE))(
variable));
return;
}
}