mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
fix: deprecate functions in object.ts (#6387)
* fix: deprecate functions in object.ts * chore: update deprecation dates and formats * chore: redo deprecation dates again
This commit is contained in:
@@ -18,10 +18,10 @@ goog.declareModuleId('Blockly.utils.deprecation');
|
||||
* Warn developers that a function or property is deprecated.
|
||||
*
|
||||
* @param name The name of the function or property.
|
||||
* @param deprecationDate The date of deprecation.
|
||||
* Prefer 'month yyyy' or 'quarter yyyy' format.
|
||||
* @param deletionDate The date of deletion, in the same format as the
|
||||
* deprecation date.
|
||||
* @param deprecationDate The date of deprecation. Prefer 'version n.0.0'
|
||||
* format, and fall back to 'month yyyy' or 'quarter yyyy' format.
|
||||
* @param deletionDate The date of deletion. Prefer 'version n.0.0'
|
||||
* format, and fall back to 'month yyyy' or 'quarter yyyy' format.
|
||||
* @param opt_use The name of a function or property to use instead, if any.
|
||||
* @alias Blockly.utils.deprecation.warn
|
||||
* @internal
|
||||
@@ -29,8 +29,8 @@ goog.declareModuleId('Blockly.utils.deprecation');
|
||||
export function warn(
|
||||
name: string, deprecationDate: string, deletionDate: string,
|
||||
opt_use?: string) {
|
||||
let msg = name + ' was deprecated on ' + deprecationDate +
|
||||
' and will be deleted on ' + deletionDate + '.';
|
||||
let msg = name + ' was deprecated in ' + deprecationDate +
|
||||
' and will be deleted in ' + deletionDate + '.';
|
||||
if (opt_use) {
|
||||
msg += '\nUse ' + opt_use + ' instead.';
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import * as deprecation from './deprecation.js';
|
||||
* @alias Blockly.utils.object.inherits
|
||||
*/
|
||||
export function inherits(childCtor: Function, parentCtor: Function) {
|
||||
deprecation.warn(
|
||||
'Blockly.utils.object.inherits', 'version 9.0.0', 'version 10.0.0');
|
||||
// Set a .superClass_ property so that methods can call parent methods
|
||||
// without hard-coding the parent class name.
|
||||
// Could be replaced by ES6's super().
|
||||
@@ -86,11 +88,8 @@ export function deepMerge(
|
||||
* @alias Blockly.utils.object.values
|
||||
*/
|
||||
export function values(obj: AnyDuringMigration): AnyDuringMigration[] {
|
||||
if (Object.values) {
|
||||
return Object.values(obj);
|
||||
}
|
||||
// Fallback for IE.
|
||||
return Object.keys(obj).map(function(e) {
|
||||
return obj[e];
|
||||
});
|
||||
deprecation.warn(
|
||||
'Blockly.utils.object.values', 'version 9.0.0', 'version 10.0.0',
|
||||
'Object.values');
|
||||
return Object.values(obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user