Skip to content

Commit

Permalink
fix: component id should be on the prototype (#6104)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-fenichel authored Apr 22, 2022
1 parent 619ee66 commit 172a8ce
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
7 changes: 7 additions & 0 deletions core/delete_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ class DeleteArea extends DragTarget {
* @protected
*/
this.wouldDelete_ = false;

/**
* The unique id for this component that is used to register with the
* ComponentManager.
* @type {string}
*/
this.id;
}

/**
Expand Down
13 changes: 13 additions & 0 deletions core/drag_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ const {Rect} = goog.requireType('Blockly.utils.Rect');
* @alias Blockly.DragTarget
*/
class DragTarget {
/**
* Constructor for DragTarget. It exists to add the id property and should not
* be called directly, only by a subclass.
*/
constructor() {
/**
* The unique id for this component that is used to register with the
* ComponentManager.
* @type {string}
*/
this.id;
}

/**
* Handles when a cursor with a block or bubble enters this drag target.
* @param {!IDraggable} _dragElement The block or bubble currently being
Expand Down
5 changes: 5 additions & 0 deletions core/interfaces/i_block_dragger.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ IBlockDragger.prototype.endDrag;
*/
IBlockDragger.prototype.getInsertionMarkers;

/**
* Sever all links from this object and do any necessary cleanup.
*/
IBlockDragger.prototype.dispose;

exports.IBlockDragger = IBlockDragger;
2 changes: 1 addition & 1 deletion core/interfaces/i_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ const IComponent = function() {};
* ComponentManager.
* @type {string}
*/
IComponent.id;
IComponent.prototype.id;

exports.IComponent = IComponent;

0 comments on commit 172a8ce

Please sign in to comment.