From 803681efa13fd0ad057eb14a44bc1b258417a5cd Mon Sep 17 00:00:00 2001 From: marisaleung Date: Mon, 19 Jun 2017 16:53:53 -0700 Subject: [PATCH] createVariable in workspaceSvg takes in id and type. --- core/workspace_svg.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 38826420f..75f405f1e 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -910,10 +910,16 @@ Blockly.WorkspaceSvg.prototype.paste = function(xmlBlock) { * variable immediately. * TODO: #468 * @param {string} name The new variable's name. + * @param {string=} opt_type The type of the variable like 'int' or 'string'. + * Does not need to be unique. Field_variable can filter variables based on + * their type. This will default to '' which is a specific type. + * @param {string=} opt_id The unique id of the variable. This will default to + * a UUID. * @return {?Blockly.VariableModel} The newly created variable. */ -Blockly.WorkspaceSvg.prototype.createVariable = function(name) { - var newVar = Blockly.WorkspaceSvg.superClass_.createVariable.call(this, name); +Blockly.WorkspaceSvg.prototype.createVariable = function(name, opt_type, opt_id) { + var newVar = Blockly.WorkspaceSvg.superClass_.createVariable.call(this, name, + opt_type, opt_id); // Don't refresh the toolbox if there's a drag in progress. if (this.toolbox_ && this.toolbox_.flyout_ && !this.currentGesture_) { this.toolbox_.refreshSelection();