mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
* Add annotations to files under core/events * Add annotations to files under core/interfaces * Add annotations to files under core/keyboard_nav * Add annotations to files under core/renderers * Add annotations to files under core/serialization * Add annotations to files under core/theme * Add annotations to files under core/toolbox * Add annotations to files under core/utils * Add annotations to files under core
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2020 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Helper function for warning developers about deprecations.
|
|
* This method is not specific to Blockly.
|
|
* @author fenichel@google.com (Rachel Fenichel)
|
|
*/
|
|
'use strict';
|
|
|
|
/**
|
|
* Helper function for warning developers about deprecations.
|
|
* This method is not specific to Blockly.
|
|
* @namespace Blockly.utils.deprecation
|
|
*/
|
|
goog.module('Blockly.utils.deprecation');
|
|
|
|
|
|
/**
|
|
* Warn developers that a function or property is deprecated.
|
|
* @param {string} name The name of the function or property.
|
|
* @param {string} deprecationDate The date of deprecation.
|
|
* Prefer 'month yyyy' or 'quarter yyyy' format.
|
|
* @param {string} deletionDate The date of deletion, in the same format as the
|
|
* deprecation date.
|
|
* @param {string=} opt_use The name of a function or property to use instead,
|
|
* if any.
|
|
* @alias Blockly.utils.deprecation.warn
|
|
*/
|
|
const warn = function(name, deprecationDate, deletionDate, opt_use) {
|
|
let msg = name + ' was deprecated on ' + deprecationDate +
|
|
' and will be deleted on ' + deletionDate + '.';
|
|
if (opt_use) {
|
|
msg += '\nUse ' + opt_use + ' instead.';
|
|
}
|
|
console.warn(msg);
|
|
};
|
|
/** @package */
|
|
exports.warn = warn;
|