From 412d8101767449b40248cf38736db077b8c9ccd6 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 2 Aug 2021 09:52:24 -0700 Subject: [PATCH 1/4] Migrate core/events/events_toolbox_item_select.js to ES6 const/let --- core/events/events_toolbox_item_select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/events/events_toolbox_item_select.js b/core/events/events_toolbox_item_select.js index a7dbb5305..694e24d5d 100644 --- a/core/events/events_toolbox_item_select.js +++ b/core/events/events_toolbox_item_select.js @@ -59,7 +59,7 @@ Blockly.Events.ToolboxItemSelect.prototype.type = Blockly.Events.TOOLBOX_ITEM_SE * @return {!Object} JSON representation. */ Blockly.Events.ToolboxItemSelect.prototype.toJson = function() { - var json = Blockly.Events.ToolboxItemSelect.superClass_.toJson.call(this); + const json = Blockly.Events.ToolboxItemSelect.superClass_.toJson.call(this); json['oldItem'] = this.oldItem; json['newItem'] = this.newItem; return json; From 7e9ee2d1c1f3bf6225d9570e629e9a0958086ae9 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 2 Aug 2021 09:52:43 -0700 Subject: [PATCH 2/4] Migrate core/events/events_toolbox_item_select.js to goog.module --- core/events/events_toolbox_item_select.js | 23 +++++++++++++---------- tests/deps.js | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/events/events_toolbox_item_select.js b/core/events/events_toolbox_item_select.js index 694e24d5d..ec587ad92 100644 --- a/core/events/events_toolbox_item_select.js +++ b/core/events/events_toolbox_item_select.js @@ -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; diff --git a/tests/deps.js b/tests/deps.js index 1e9ef54f4..c5dd33a1d 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -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']); From df71e638303c274fa0f87551c02231a8ac4469ff Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 2 Aug 2021 09:53:12 -0700 Subject: [PATCH 3/4] Migrate core/events/events_toolbox_item_select.js to named requires --- core/events/events_toolbox_item_select.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/events/events_toolbox_item_select.js b/core/events/events_toolbox_item_select.js index ec587ad92..0ef7111f8 100644 --- a/core/events/events_toolbox_item_select.js +++ b/core/events/events_toolbox_item_select.js @@ -13,10 +13,10 @@ goog.module('Blockly.Events.ToolboxItemSelect'); goog.module.declareLegacyNamespace(); -goog.require('Blockly.Events'); -goog.require('Blockly.Events.UiBase'); -goog.require('Blockly.registry'); -goog.require('Blockly.utils.object'); +const Events = goog.require('Blockly.Events'); +const UiBase = goog.require('Blockly.Events.UiBase'); +const object = goog.require('Blockly.utils.object'); +const registry = goog.require('Blockly.registry'); /** @@ -27,7 +27,7 @@ goog.require('Blockly.utils.object'); * a blank event. * @param {string=} opt_workspaceId The workspace identifier for this event. * Undefined for a blank event. - * @extends {Blockly.Events.UiBase} + * @extends {UiBase} * @constructor */ const ToolboxItemSelect = function(opt_oldItem, opt_newItem, @@ -47,13 +47,13 @@ const ToolboxItemSelect = function(opt_oldItem, opt_newItem, */ this.newItem = opt_newItem; }; -Blockly.utils.object.inherits(ToolboxItemSelect, Blockly.Events.UiBase); +object.inherits(ToolboxItemSelect, UiBase); /** * Type of this event. * @type {string} */ -ToolboxItemSelect.prototype.type = Blockly.Events.TOOLBOX_ITEM_SELECT; +ToolboxItemSelect.prototype.type = Events.TOOLBOX_ITEM_SELECT; /** * Encode the event as JSON. @@ -76,7 +76,7 @@ ToolboxItemSelect.prototype.fromJson = function(json) { this.newItem = json['newItem']; }; -Blockly.registry.register(Blockly.registry.Type.EVENT, - Blockly.Events.TOOLBOX_ITEM_SELECT, ToolboxItemSelect); +registry.register(registry.Type.EVENT, + Events.TOOLBOX_ITEM_SELECT, ToolboxItemSelect); exports = ToolboxItemSelect; From bee144fae2a081ad99c073b8f9786d05285b0338 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 2 Aug 2021 09:53:38 -0700 Subject: [PATCH 4/4] clang-format core/events/events_toolbox_item_select.js --- core/events/events_toolbox_item_select.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/events/events_toolbox_item_select.js b/core/events/events_toolbox_item_select.js index 0ef7111f8..0fddaf4e9 100644 --- a/core/events/events_toolbox_item_select.js +++ b/core/events/events_toolbox_item_select.js @@ -30,10 +30,8 @@ const registry = goog.require('Blockly.registry'); * @extends {UiBase} * @constructor */ -const ToolboxItemSelect = function(opt_oldItem, opt_newItem, - opt_workspaceId) { - ToolboxItemSelect.superClass_.constructor.call( - this, opt_workspaceId); +const ToolboxItemSelect = function(opt_oldItem, opt_newItem, opt_workspaceId) { + ToolboxItemSelect.superClass_.constructor.call(this, opt_workspaceId); /** * The previously selected toolbox item. @@ -76,7 +74,7 @@ ToolboxItemSelect.prototype.fromJson = function(json) { this.newItem = json['newItem']; }; -registry.register(registry.Type.EVENT, - Events.TOOLBOX_ITEM_SELECT, ToolboxItemSelect); +registry.register( + registry.Type.EVENT, Events.TOOLBOX_ITEM_SELECT, ToolboxItemSelect); exports = ToolboxItemSelect;