Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: component id should be on the prototype #6104

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this isn't meant to be constructed directly, should it be tagged @abstract?

* 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;