Migrate core/events/events_toolbox_item_select.js to goog.module

This commit is contained in:
Aaron Dodson
2021-08-02 09:52:43 -07:00
parent 412d810176
commit 7e9ee2d1c1
2 changed files with 14 additions and 11 deletions

View File

@@ -10,7 +10,8 @@
*/
'use strict';
goog.provide('Blockly.Events.ToolboxItemSelect');
goog.module('Blockly.Events.ToolboxItemSelect');
goog.module.declareLegacyNamespace();
goog.require('Blockly.Events');
goog.require('Blockly.Events.UiBase');
@@ -29,9 +30,9 @@ goog.require('Blockly.utils.object');
* @extends {Blockly.Events.UiBase}
* @constructor
*/
Blockly.Events.ToolboxItemSelect = function(opt_oldItem, opt_newItem,
const ToolboxItemSelect = function(opt_oldItem, opt_newItem,
opt_workspaceId) {
Blockly.Events.ToolboxItemSelect.superClass_.constructor.call(
ToolboxItemSelect.superClass_.constructor.call(
this, opt_workspaceId);
/**
@@ -46,20 +47,20 @@ Blockly.Events.ToolboxItemSelect = function(opt_oldItem, opt_newItem,
*/
this.newItem = opt_newItem;
};
Blockly.utils.object.inherits(Blockly.Events.ToolboxItemSelect, Blockly.Events.UiBase);
Blockly.utils.object.inherits(ToolboxItemSelect, Blockly.Events.UiBase);
/**
* Type of this event.
* @type {string}
*/
Blockly.Events.ToolboxItemSelect.prototype.type = Blockly.Events.TOOLBOX_ITEM_SELECT;
ToolboxItemSelect.prototype.type = Blockly.Events.TOOLBOX_ITEM_SELECT;
/**
* Encode the event as JSON.
* @return {!Object} JSON representation.
*/
Blockly.Events.ToolboxItemSelect.prototype.toJson = function() {
const json = Blockly.Events.ToolboxItemSelect.superClass_.toJson.call(this);
ToolboxItemSelect.prototype.toJson = function() {
const json = ToolboxItemSelect.superClass_.toJson.call(this);
json['oldItem'] = this.oldItem;
json['newItem'] = this.newItem;
return json;
@@ -69,11 +70,13 @@ Blockly.Events.ToolboxItemSelect.prototype.toJson = function() {
* Decode the JSON event.
* @param {!Object} json JSON representation.
*/
Blockly.Events.ToolboxItemSelect.prototype.fromJson = function(json) {
Blockly.Events.ToolboxItemSelect.superClass_.fromJson.call(this, json);
ToolboxItemSelect.prototype.fromJson = function(json) {
ToolboxItemSelect.superClass_.fromJson.call(this, json);
this.oldItem = json['oldItem'];
this.newItem = json['newItem'];
};
Blockly.registry.register(Blockly.registry.Type.EVENT,
Blockly.Events.TOOLBOX_ITEM_SELECT, Blockly.Events.ToolboxItemSelect);
Blockly.Events.TOOLBOX_ITEM_SELECT, ToolboxItemSelect);
exports = ToolboxItemSelect;

View File

@@ -42,7 +42,7 @@ goog.addDependency('../../core/events/events_click.js', ['Blockly.Events.Click']
goog.addDependency('../../core/events/events_marker_move.js', ['Blockly.Events.MarkerMove'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
goog.addDependency('../../core/events/events_selected.js', ['Blockly.Events.Selected'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
goog.addDependency('../../core/events/events_theme_change.js', ['Blockly.Events.ThemeChange'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
goog.addDependency('../../core/events/events_toolbox_item_select.js', ['Blockly.Events.ToolboxItemSelect'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
goog.addDependency('../../core/events/events_toolbox_item_select.js', ['Blockly.Events.ToolboxItemSelect'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/events/events_trashcan_open.js', ['Blockly.Events.TrashcanOpen'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
goog.addDependency('../../core/events/events_viewport.js', ['Blockly.Events.ViewportChange'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
goog.addDependency('../../core/events/ui_events.js', ['Blockly.Events.Ui', 'Blockly.Events.UiBase'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.registry', 'Blockly.utils.object']);