Deprecated API
markAsWarning
embeds a warning in the attribute on the given object, and the attribute needs to exist on the given object.removeProperty
redefines the removed property on the given object, and embeds an error message. The property should not exist on the given object.
According to the module division, each module maintains an obsolete file. In order to facilitate maintenance, the name is unified as deprecated.ts and placed in the directory of the corresponding module, and the file needs to be import
in the index.ts
file of the corresponding module, such as import'./deprecated'
.
// For APIs that are not compatible with replacement parameters, adapt them through appropriate custom functions
replaceProperty(AnimationComponent.prototype, 'AnimationComponent.prototype', [
{
name: 'removeClip',
newName: 'removeState',
customFunction: function (...args: any) {
const arg0 = args[0] as AnimationClip;
return AnimationComponent.prototype.removeState.call(this, arg0.name);
]);
replaceProperty(vmath, 'vmath', [
{
name: 'vec2',
newName: 'Vec2',
target: math,
targetName: 'math',
'logTimes': 1
},
{
name: 'EPSILON',
target: math,
targetName: 'math',
'logTimes': 2
]);
removeProperty(vmath, 'vmath', [
{
'name': 'random',
'suggest': 'use Math.random.'
}
]);
markAsWarning(math, 'math', [
{
'name': 'toRadian'
}
]);
replaceProperty
does not pass innewName
ornewTarget
, which means it is consistent withname
ortarget
.