Migrate core/events/block_events.js named requires

This commit is contained in:
kozbial
2021-08-06 17:02:18 -07:00
committed by Monica Kozbial
parent 9ac531ba58
commit dc2438eb28
4 changed files with 43 additions and 43 deletions

View File

@@ -13,17 +13,17 @@
goog.module('Blockly.Events.VarBase');
goog.module.declareLegacyNamespace();
goog.require('Blockly.Events.Abstract');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.VariableModel');
const Abstract = goog.require('Blockly.Events.Abstract');
/* eslint-disable-next-line no-unused-vars */
const VariableModel = goog.requireType('Blockly.VariableModel');
const object = goog.require('Blockly.utils.object');
/**
* Abstract class for a variable event.
* @param {!Blockly.VariableModel=} opt_variable The variable this event
* @param {!VariableModel=} opt_variable The variable this event
* corresponds to. Undefined for a blank event.
* @extends {Blockly.Events.Abstract}
* @extends {Abstract}
* @constructor
*/
const VarBase = function(opt_variable) {
@@ -42,7 +42,7 @@ const VarBase = function(opt_variable) {
*/
this.workspaceId = this.isBlank ? '' : opt_variable.workspace.id;
};
Blockly.utils.object.inherits(VarBase, Blockly.Events.Abstract);
object.inherits(VarBase, Abstract);
/**
* Encode the event as JSON.

View File

@@ -13,19 +13,19 @@
goog.module('Blockly.Events.VarCreate');
goog.module.declareLegacyNamespace();
goog.require('Blockly.Events');
goog.require('Blockly.Events.VarBase');
goog.require('Blockly.registry');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.VariableModel');
const Events = goog.require('Blockly.Events');
const VarBase = goog.require('Blockly.Events.VarBase');
/* eslint-disable-next-line no-unused-vars */
const VariableModel = goog.requireType('Blockly.VariableModel');
const object = goog.require('Blockly.utils.object');
const registry = goog.require('Blockly.registry');
/**
* Class for a variable creation event.
* @param {!Blockly.VariableModel=} opt_variable The created variable. Undefined
* @param {!VariableModel=} opt_variable The created variable. Undefined
* for a blank event.
* @extends {Blockly.Events.VarBase}
* @extends {VarBase}
* @constructor
*/
const VarCreate = function(opt_variable) {
@@ -37,13 +37,13 @@ const VarCreate = function(opt_variable) {
this.varType = opt_variable.type;
this.varName = opt_variable.name;
};
Blockly.utils.object.inherits(VarCreate, Blockly.Events.VarBase);
object.inherits(VarCreate, VarBase);
/**
* Type of this event.
* @type {string}
*/
VarCreate.prototype.type = Blockly.Events.VAR_CREATE;
VarCreate.prototype.type = Events.VAR_CREATE;
/**
* Encode the event as JSON.
@@ -79,7 +79,7 @@ VarCreate.prototype.run = function(forward) {
}
};
Blockly.registry.register(Blockly.registry.Type.EVENT,
Blockly.Events.VAR_CREATE, VarCreate);
registry.register(registry.Type.EVENT,
Events.VAR_CREATE, VarCreate);
exports = VarCreate;

View File

@@ -13,19 +13,19 @@
goog.module('Blockly.Events.VarDelete');
goog.module.declareLegacyNamespace();
goog.require('Blockly.Events');
goog.require('Blockly.Events.VarBase');
goog.require('Blockly.registry');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.VariableModel');
const Events = goog.require('Blockly.Events');
const VarBase = goog.require('Blockly.Events.VarBase');
/* eslint-disable-next-line no-unused-vars */
const VariableModel = goog.requireType('Blockly.VariableModel');
const object = goog.require('Blockly.utils.object');
const registry = goog.require('Blockly.registry');
/**
* Class for a variable deletion event.
* @param {!Blockly.VariableModel=} opt_variable The deleted variable. Undefined
* @param {!VariableModel=} opt_variable The deleted variable. Undefined
* for a blank event.
* @extends {Blockly.Events.VarBase}
* @extends {VarBase}
* @constructor
*/
const VarDelete = function(opt_variable) {
@@ -37,13 +37,13 @@ const VarDelete = function(opt_variable) {
this.varType = opt_variable.type;
this.varName = opt_variable.name;
};
Blockly.utils.object.inherits(VarDelete, Blockly.Events.VarBase);
object.inherits(VarDelete, VarBase);
/**
* Type of this event.
* @type {string}
*/
VarDelete.prototype.type = Blockly.Events.VAR_DELETE;
VarDelete.prototype.type = Events.VAR_DELETE;
/**
* Encode the event as JSON.
@@ -79,7 +79,7 @@ VarDelete.prototype.run = function(forward) {
}
};
Blockly.registry.register(Blockly.registry.Type.EVENT,
Blockly.Events.VAR_DELETE, VarDelete);
registry.register(registry.Type.EVENT,
Events.VAR_DELETE, VarDelete);
exports = VarDelete;

View File

@@ -13,20 +13,20 @@
goog.module('Blockly.Events.VarRename');
goog.module.declareLegacyNamespace();
goog.require('Blockly.Events');
goog.require('Blockly.Events.VarBase');
goog.require('Blockly.registry');
goog.require('Blockly.utils.object');
goog.requireType('Blockly.VariableModel');
const Events = goog.require('Blockly.Events');
const VarBase = goog.require('Blockly.Events.VarBase');
/* eslint-disable-next-line no-unused-vars */
const VariableModel = goog.requireType('Blockly.VariableModel');
const object = goog.require('Blockly.utils.object');
const registry = goog.require('Blockly.registry');
/**
* Class for a variable rename event.
* @param {!Blockly.VariableModel=} opt_variable The renamed variable. Undefined
* @param {!VariableModel=} opt_variable The renamed variable. Undefined
* for a blank event.
* @param {string=} newName The new name the variable will be changed to.
* @extends {Blockly.Events.VarBase}
* @extends {VarBase}
* @constructor
*/
const VarRename = function(opt_variable, newName) {
@@ -38,13 +38,13 @@ const VarRename = function(opt_variable, newName) {
this.oldName = opt_variable.name;
this.newName = typeof newName == 'undefined' ? '' : newName;
};
Blockly.utils.object.inherits(VarRename, Blockly.Events.VarBase);
object.inherits(VarRename, VarBase);
/**
* Type of this event.
* @type {string}
*/
VarRename.prototype.type = Blockly.Events.VAR_RENAME;
VarRename.prototype.type = Events.VAR_RENAME;
/**
* Encode the event as JSON.
@@ -80,7 +80,7 @@ VarRename.prototype.run = function(forward) {
}
};
Blockly.registry.register(Blockly.registry.Type.EVENT,
Blockly.Events.VAR_RENAME, VarRename);
registry.register(registry.Type.EVENT,
Events.VAR_RENAME, VarRename);
exports = VarRename;