Skip to content

Commit

Permalink
improve type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
trodi committed Nov 10, 2015
1 parent c7753d4 commit 11906b7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
7 changes: 7 additions & 0 deletions core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ Blockly.Block.obtain = function(workspace, prototypeName) {
}
};

/**
* Optional text data that round-trips beween blocks and XML.
* Has no effect. May be used by 3rd parties for meta information.
* @type {?string}
*/
Blockly.Block.prototype.data = null;

/**
* Initialization for one block.
* @param {!Blockly.Workspace} workspace The new block's workspace.
Expand Down
2 changes: 1 addition & 1 deletion core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ Blockly.BlockSvg.prototype.snapToGrid = function() {
/**
* Returns a bounding box describing the dimensions of this block
* and any blocks stacked below it.
* @return {!Object} Object with height and width properties.
* @return {!{height: number, width: number}} Object with height and width properties.
*/
Blockly.BlockSvg.prototype.getHeightWidth = function() {
var height = this.height;
Expand Down
2 changes: 1 addition & 1 deletion core/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ Blockly.Connection.prototype.tighten_ = function() {
* in the database and the current location (as a result of dragging).
* @param {number} dy Vertical offset between this connection's location
* in the database and the current location (as a result of dragging).
* @return {!Object} Contains two properties: 'connection' which is either
* @return {!{connection: ?Blockly.Connection, radius: number}} Contains two properties: 'connection' which is either
* another connection or null, and 'radius' which is the distance.
*/
Blockly.Connection.prototype.closest = function(maxLimit, dx, dy) {
Expand Down
4 changes: 0 additions & 4 deletions core/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ Blockly.Xml.blockToDom_ = function(block) {
}

if (block.data) {
// Optional text data that round-trips beween blocks and XML.
// Has no effect. May be used by 3rd parties for meta information.
var dataElement = goog.dom.createDom('data', null, block.data);
element.appendChild(dataElement);
}
Expand Down Expand Up @@ -428,8 +426,6 @@ Blockly.Xml.domToBlockHeadless_ =
}
break;
case 'data':
// Optional text data that round-trips beween blocks and XML.
// Has no effect. May be used by 3rd parties for meta information.
block.data = xmlChild.textContent;
break;
case 'title':
Expand Down

0 comments on commit 11906b7

Please sign in to comment.