Commit 11906b75 authored by Troy McKinnon's avatar Troy McKinnon

improve type annotations

parent c7753d4e
...@@ -72,6 +72,13 @@ Blockly.Block.obtain = function(workspace, prototypeName) { ...@@ -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. * Initialization for one block.
* @param {!Blockly.Workspace} workspace The new block's workspace. * @param {!Blockly.Workspace} workspace The new block's workspace.
......
...@@ -315,7 +315,7 @@ Blockly.BlockSvg.prototype.snapToGrid = function() { ...@@ -315,7 +315,7 @@ Blockly.BlockSvg.prototype.snapToGrid = function() {
/** /**
* Returns a bounding box describing the dimensions of this block * Returns a bounding box describing the dimensions of this block
* and any blocks stacked below it. * 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() { Blockly.BlockSvg.prototype.getHeightWidth = function() {
var height = this.height; var height = this.height;
......
...@@ -493,7 +493,7 @@ Blockly.Connection.prototype.tighten_ = function() { ...@@ -493,7 +493,7 @@ Blockly.Connection.prototype.tighten_ = function() {
* in the database and the current location (as a result of dragging). * in the database and the current location (as a result of dragging).
* @param {number} dy Vertical offset between this connection's location * @param {number} dy Vertical offset between this connection's location
* in the database and the current location (as a result of dragging). * 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. * another connection or null, and 'radius' which is the distance.
*/ */
Blockly.Connection.prototype.closest = function(maxLimit, dx, dy) { Blockly.Connection.prototype.closest = function(maxLimit, dx, dy) {
......
...@@ -99,8 +99,6 @@ Blockly.Xml.blockToDom_ = function(block) { ...@@ -99,8 +99,6 @@ Blockly.Xml.blockToDom_ = function(block) {
} }
if (block.data) { 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); var dataElement = goog.dom.createDom('data', null, block.data);
element.appendChild(dataElement); element.appendChild(dataElement);
} }
...@@ -428,8 +426,6 @@ Blockly.Xml.domToBlockHeadless_ = ...@@ -428,8 +426,6 @@ Blockly.Xml.domToBlockHeadless_ =
} }
break; break;
case 'data': 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; block.data = xmlChild.textContent;
break; break;
case 'title': case 'title':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment