mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
improve type annotations
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user