Commit f737b3ea authored by Neil Fraser's avatar Neil Fraser

Merge pull request #127 from trodi/master

adding missing type documentation to public fields
parents 64bd9d49 68dbb716
...@@ -90,14 +90,23 @@ Blockly.Block.prototype.initialize = function(workspace, prototypeName) { ...@@ -90,14 +90,23 @@ Blockly.Block.prototype.initialize = function(workspace, prototypeName) {
* @param {string} prototypeName The typename of the block. * @param {string} prototypeName The typename of the block.
*/ */
Blockly.Block.prototype.fill = function(workspace, prototypeName) { Blockly.Block.prototype.fill = function(workspace, prototypeName) {
/** @type {?Blockly.Connection} */
this.outputConnection = null; this.outputConnection = null;
/** @type {?Blockly.Connection} */
this.nextConnection = null; this.nextConnection = null;
/** @type {?Blockly.Connection} */
this.previousConnection = null; this.previousConnection = null;
/** @type {Blockly.Input[]} */
this.inputList = []; this.inputList = [];
/** @type {?boolean} */
this.inputsInline = undefined; this.inputsInline = undefined;
/** @type {boolean} */
this.rendered = false; this.rendered = false;
/** @type {boolean} */
this.disabled = false; this.disabled = false;
/** @type {(string|Function|object)} */
this.tooltip = ''; this.tooltip = '';
/** @type {boolean} */
this.contextMenu = true; this.contextMenu = true;
this.parentBlock_ = null; this.parentBlock_ = null;
...@@ -107,16 +116,21 @@ Blockly.Block.prototype.fill = function(workspace, prototypeName) { ...@@ -107,16 +116,21 @@ Blockly.Block.prototype.fill = function(workspace, prototypeName) {
this.editable_ = true; this.editable_ = true;
this.collapsed_ = false; this.collapsed_ = false;
/** @type {?(string|Blockly.Comment)} */
this.comment = null; this.comment = null;
this.xy_ = new goog.math.Coordinate(0, 0); this.xy_ = new goog.math.Coordinate(0, 0);
/** @type {Blockly.Workspace} */
this.workspace = workspace; this.workspace = workspace;
/** @type {boolean} */
this.isInFlyout = workspace.isFlyout; this.isInFlyout = workspace.isFlyout;
/** @type {boolean} */
this.RTL = workspace.RTL; this.RTL = workspace.RTL;
// Copy the type-specific functions and data from the prototype. // Copy the type-specific functions and data from the prototype.
if (prototypeName) { if (prototypeName) {
/** @type {?string} */
this.type = prototypeName; this.type = prototypeName;
var prototype = Blockly.Blocks[prototypeName]; var prototype = Blockly.Blocks[prototypeName];
goog.asserts.assertObject(prototype, goog.asserts.assertObject(prototype,
...@@ -1186,7 +1200,7 @@ Blockly.Block.prototype.removeInput = function(name, opt_quiet) { ...@@ -1186,7 +1200,7 @@ Blockly.Block.prototype.removeInput = function(name, opt_quiet) {
/** /**
* Fetches the named input object. * Fetches the named input object.
* @param {string} name The name of the input. * @param {string} name The name of the input.
* @return {Object} The input object, or null of the input does not exist. * @return {?Blockly.Input} The input object, or null of the input does not exist.
*/ */
Blockly.Block.prototype.getInput = function(name) { Blockly.Block.prototype.getInput = function(name) {
for (var i = 0, input; input = this.inputList[i]; i++) { for (var i = 0, input; input = this.inputList[i]; i++) {
......
...@@ -38,7 +38,9 @@ goog.require('goog.dom'); ...@@ -38,7 +38,9 @@ goog.require('goog.dom');
*/ */
Blockly.Connection = function(source, type) { Blockly.Connection = function(source, type) {
this.sourceBlock_ = source; this.sourceBlock_ = source;
/** @type {?Blockly.Connection} */
this.targetConnection = null; this.targetConnection = null;
/** @type {number} */
this.type = type; this.type = type;
this.x_ = 0; this.x_ = 0;
this.y_ = 0; this.y_ = 0;
......
...@@ -180,7 +180,7 @@ Blockly.Field.prototype.setVisible = function(visible) { ...@@ -180,7 +180,7 @@ Blockly.Field.prototype.setVisible = function(visible) {
/** /**
* Sets a new change handler for editable fields. * Sets a new change handler for editable fields.
* @param {Function} handler New change handler, or null. * @param {?Function} handler New change handler, or null.
*/ */
Blockly.Field.prototype.setChangeHandler = function(handler) { Blockly.Field.prototype.setChangeHandler = function(handler) {
this.changeHandler_ = handler; this.changeHandler_ = handler;
......
...@@ -39,7 +39,7 @@ goog.require('goog.userAgent'); ...@@ -39,7 +39,7 @@ goog.require('goog.userAgent');
/** /**
* Class for an editable dropdown field. * Class for an editable dropdown field.
* @param {(!Array.<string>|!Function)} menuGenerator An array of options * @param {(!Array.<!Array.<string>>|!Function)} menuGenerator An array of options
* for a dropdown list, or a function which generates these options. * for a dropdown list, or a function which generates these options.
* @param {Function} opt_changeHandler A function that is executed when a new * @param {Function} opt_changeHandler A function that is executed when a new
* option is selected, with the newly selected value as its sole argument. * option is selected, with the newly selected value as its sole argument.
......
...@@ -43,11 +43,16 @@ goog.require('goog.asserts'); ...@@ -43,11 +43,16 @@ goog.require('goog.asserts');
* @constructor * @constructor
*/ */
Blockly.Input = function(type, name, block, connection) { Blockly.Input = function(type, name, block, connection) {
/** @type {number} */
this.type = type; this.type = type;
/** @type {string} */
this.name = name; this.name = name;
this.sourceBlock_ = block; this.sourceBlock_ = block;
/** @type {Blockly.Connection} */
this.connection = connection; this.connection = connection;
/** @type {Blockly.Field[]} */
this.fieldRow = []; this.fieldRow = [];
/** @type {number} */
this.align = Blockly.ALIGN_LEFT; this.align = Blockly.ALIGN_LEFT;
this.visible_ = true; this.visible_ = true;
......
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