Migrate core/events/block_events.js to ES6 const/let

This commit is contained in:
kozbial
2021-08-06 16:33:44 -07:00
committed by Monica Kozbial
parent d1ab960f0f
commit 6e821fb9fc
4 changed files with 7 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ Blockly.utils.object.inherits(Blockly.Events.VarBase, Blockly.Events.Abstract);
* @return {!Object} JSON representation.
*/
Blockly.Events.VarBase.prototype.toJson = function() {
var json = Blockly.Events.VarBase.superClass_.toJson.call(this);
const json = Blockly.Events.VarBase.superClass_.toJson.call(this);
json['varId'] = this.varId;
return json;
};

View File

@@ -49,7 +49,7 @@ Blockly.Events.VarCreate.prototype.type = Blockly.Events.VAR_CREATE;
* @return {!Object} JSON representation.
*/
Blockly.Events.VarCreate.prototype.toJson = function() {
var json = Blockly.Events.VarCreate.superClass_.toJson.call(this);
const json = Blockly.Events.VarCreate.superClass_.toJson.call(this);
json['varType'] = this.varType;
json['varName'] = this.varName;
return json;
@@ -70,7 +70,7 @@ Blockly.Events.VarCreate.prototype.fromJson = function(json) {
* @param {boolean} forward True if run forward, false if run backward (undo).
*/
Blockly.Events.VarCreate.prototype.run = function(forward) {
var workspace = this.getEventWorkspace_();
const workspace = this.getEventWorkspace_();
if (forward) {
workspace.createVariable(this.varName, this.varType, this.varId);
} else {

View File

@@ -49,7 +49,7 @@ Blockly.Events.VarDelete.prototype.type = Blockly.Events.VAR_DELETE;
* @return {!Object} JSON representation.
*/
Blockly.Events.VarDelete.prototype.toJson = function() {
var json = Blockly.Events.VarDelete.superClass_.toJson.call(this);
const json = Blockly.Events.VarDelete.superClass_.toJson.call(this);
json['varType'] = this.varType;
json['varName'] = this.varName;
return json;
@@ -70,7 +70,7 @@ Blockly.Events.VarDelete.prototype.fromJson = function(json) {
* @param {boolean} forward True if run forward, false if run backward (undo).
*/
Blockly.Events.VarDelete.prototype.run = function(forward) {
var workspace = this.getEventWorkspace_();
const workspace = this.getEventWorkspace_();
if (forward) {
workspace.deleteVariableById(this.varId);
} else {

View File

@@ -50,7 +50,7 @@ Blockly.Events.VarRename.prototype.type = Blockly.Events.VAR_RENAME;
* @return {!Object} JSON representation.
*/
Blockly.Events.VarRename.prototype.toJson = function() {
var json = Blockly.Events.VarRename.superClass_.toJson.call(this);
const json = Blockly.Events.VarRename.superClass_.toJson.call(this);
json['oldName'] = this.oldName;
json['newName'] = this.newName;
return json;
@@ -71,7 +71,7 @@ Blockly.Events.VarRename.prototype.fromJson = function(json) {
* @param {boolean} forward True if run forward, false if run backward (undo).
*/
Blockly.Events.VarRename.prototype.run = function(forward) {
var workspace = this.getEventWorkspace_();
const workspace = this.getEventWorkspace_();
if (forward) {
workspace.renameVariableById(this.varId, this.newName);
} else {