mutation / compose fn annotations (#3149)

* Add compose / decompose type annotations.
This commit is contained in:
Sam El-Husseini
2019-10-03 14:25:07 -07:00
committed by GitHub
parent f5909c9916
commit 735a72c20a
2 changed files with 41 additions and 0 deletions

View File

@@ -279,6 +279,27 @@ Blockly.Block.prototype.colourTertiary_ = null;
*/
Blockly.Block.prototype.styleName_ = null;
/**
* An optional serialization method for defining how to serialize the
* mutation state. This must be coupled with defining `domToMutation`.
* @type {?function(...):!Element}
*/
Blockly.Block.prototype.mutationToDom;
/**
* An optional deserialization method for defining how to deserialize the
* mutation state. This must be coupled with defining `mutationToDom`.
* @type {?function(!Element)}
*/
Blockly.Block.prototype.domToMutation;
/**
* An optional property for suppressing adding STATEMENT_PREFIX and
* STATEMENT_SUFFIX to generated code.
* @type {?boolean}
*/
Blockly.Block.prototype.suppressPrefixSuffix;
/**
* Dispose of this block.
* @param {boolean} healStack If true, then try to heal any gap by connecting

View File

@@ -208,6 +208,26 @@ Blockly.BlockSvg.TAB_WIDTH = 8;
*/
Blockly.BlockSvg.START_HAT = false;
/**
* An optional method called when a mutator dialog is first opened.
* This function must create and initialize a top-level block for the mutator
* dialog, and return it. This function should also populate this top-level
* block with any sub-blocks which are appropriate. This method must also be
* coupled with defining a `compose` method for the default mutation dialog
* button and UI to appear.
* @type {?function(Blockly.WorkspaceSvg):!Blockly.BlockSvg}
*/
Blockly.BlockSvg.prototype.decompose;
/**
* An optional method called when a mutator dialog saves its content.
* This function is called to modify the original block according to new
* settings. This method must also be coupled with defining a `decompose`
* method for the default mutation dialog button and UI to appear.
* @type {?function(!Blockly.BlockSvg)}
*/
Blockly.BlockSvg.prototype.compose;
/**
* Create and initialize the SVG representation of the block.
* May be called more than once.