diff --git a/core/events/events_click.js b/core/events/events_click.js index 19775c41e..a19ee6b75 100644 --- a/core/events/events_click.js +++ b/core/events/events_click.js @@ -10,7 +10,8 @@ */ 'use strict'; -goog.provide('Blockly.Events.Click'); +goog.module('Blockly.Events.Click'); +goog.module.declareLegacyNamespace(); goog.require('Blockly.Events'); goog.require('Blockly.Events.UiBase'); @@ -32,9 +33,9 @@ goog.requireType('Blockly.Block'); * @extends {Blockly.Events.UiBase} * @constructor */ -Blockly.Events.Click = function(opt_block, opt_workspaceId, opt_targetType) { +const Click = function(opt_block, opt_workspaceId, opt_targetType) { const workspaceId = opt_block ? opt_block.workspace.id : opt_workspaceId; - Blockly.Events.Click.superClass_.constructor.call(this, workspaceId); + Click.superClass_.constructor.call(this, workspaceId); this.blockId = opt_block ? opt_block.id : null; /** @@ -43,20 +44,20 @@ Blockly.Events.Click = function(opt_block, opt_workspaceId, opt_targetType) { */ this.targetType = opt_targetType; }; -Blockly.utils.object.inherits(Blockly.Events.Click, Blockly.Events.UiBase); +Blockly.utils.object.inherits(Click, Blockly.Events.UiBase); /** * Type of this event. * @type {string} */ -Blockly.Events.Click.prototype.type = Blockly.Events.CLICK; +Click.prototype.type = Blockly.Events.CLICK; /** * Encode the event as JSON. * @return {!Object} JSON representation. */ -Blockly.Events.Click.prototype.toJson = function() { - const json = Blockly.Events.Click.superClass_.toJson.call(this); +Click.prototype.toJson = function() { + const json = Click.superClass_.toJson.call(this); json['targetType'] = this.targetType; if (this.blockId) { json['blockId'] = this.blockId; @@ -68,11 +69,13 @@ Blockly.Events.Click.prototype.toJson = function() { * Decode the JSON event. * @param {!Object} json JSON representation. */ -Blockly.Events.Click.prototype.fromJson = function(json) { - Blockly.Events.Click.superClass_.fromJson.call(this, json); +Click.prototype.fromJson = function(json) { + Click.superClass_.fromJson.call(this, json); this.targetType = json['targetType']; this.blockId = json['blockId']; }; Blockly.registry.register(Blockly.registry.Type.EVENT, Blockly.Events.CLICK, - Blockly.Events.Click); + Click); + +exports = Click; diff --git a/tests/deps.js b/tests/deps.js index 1e9ef54f4..4ddac911b 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -38,7 +38,7 @@ goog.addDependency('../../core/events/events.js', ['Blockly.Events'], ['Blockly. goog.addDependency('../../core/events/events_abstract.js', ['Blockly.Events.Abstract'], ['Blockly.Events']); goog.addDependency('../../core/events/events_block_drag.js', ['Blockly.Events.BlockDrag'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']); goog.addDependency('../../core/events/events_bubble_open.js', ['Blockly.Events.BubbleOpen'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']); -goog.addDependency('../../core/events/events_click.js', ['Blockly.Events.Click'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']); +goog.addDependency('../../core/events/events_click.js', ['Blockly.Events.Click'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'}); 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']);