Skip to content

Commit

Permalink
chore: add deprecation warnings in blockly.js
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-fenichel committed Nov 16, 2021
1 parent 37adf46 commit b9e663f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
26 changes: 23 additions & 3 deletions core/blockly.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,16 @@ exports.svgSize = common.svgSize;
* Size the workspace when the contents change. This also updates
* scrollbars accordingly.
* @param {!WorkspaceSvg} workspace The workspace to resize.
* @deprecated
* @alias Blockly.resizeSvgContents
*/
exports.resizeSvgContents = common.resizeSvgContents;
const resizeSvgContents = function(workspace) {
deprecation.warn(
'Blockly.resizeSvgContents', 'December 2021', 'December 2022',
'Blockly.common.resizeSvgContents');
common.resizeSvgContents(workspace);
};
exports.resizeSvgContents = resizeSvgContents;

/**
* Copy a block or workspace comment onto the local clipboard.
Expand Down Expand Up @@ -346,7 +353,13 @@ exports.duplicate = clipboard.duplicate;
* @param {boolean=} opt_onlyClosePopups Whether only popups should be closed.
* @alias Blockly.hideChaff
*/
exports.hideChaff = common.hideChaff;
const hideChaff = function(opt_onlyClosePopups) {
deprecation.warn(
'Blockly.hideChaff', 'December 2021', 'December 2022',
'workspace.hideChaff');
common.hideChaff(opt_onlyClosePopups);
};
exports.hideChaff = hideChaff;

/**
* Returns the main workspace. Returns the last used main workspace (based on
Expand All @@ -369,9 +382,16 @@ exports.defineBlocksWithJsonArray = common.defineBlocksWithJsonArray;
* Is the given string a number (includes negative and decimals).
* @param {string} str Input string.
* @return {boolean} True if number, false otherwise.
* @deprecated
* @alias Blockly.isNumber
*/
exports.isNumber = utils.math.isNumber;
const isNumber = function(str) {
deprecation.warn(
'Blockly.isNumber', 'December 2021', 'December 2022',
'Blockly.utils.math.isNumber');
return utils.math.isNumber(str);
};
exports.isNumber = isNumber;

/**
* Set the parent container. This is the container element that the WidgetDiv,
Expand Down
2 changes: 1 addition & 1 deletion core/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ exports.resizeSvgContents = resizeSvgContents;
* Returns the dimensions of the specified SVG image.
* @param {!SVGElement} svg SVG image.
* @return {!Size} Contains width and height properties.
* @deprecated Use workspace.setCachedParentSvgSize. (2021 March 5)
* @deprecated Use workspace.getCachedParentSvgSize. (2021 March 5)
* @alias Blockly.common.svgSize
*/
const svgSize = function(svg) {
Expand Down

0 comments on commit b9e663f

Please sign in to comment.