engine
engine copied to clipboard
List of deprecated members
@playcanvas/react performs simple validation of engine props at runtime. It would be useful to exclude any deprecated members. Adding something like the following would help provide a list of deprecated members
const deprecated = new Set()
function markDeprecated(obj, memberName, descriptor) {
Object.defineProperty(obj, memberName, descriptor);
deprecated.add(`${obj.name}.${memberName}`); // use a better key here
}
// Example usage
markDeprecated(Texture.prototype, 'rgbm', {
get: function () {
Debug.deprecated('pc.Texture#rgbm is deprecated. Use pc.Texture#type instead.');
return this.type === TEXTURETYPE_RGBM;
},
set: function (rgbm) {
Debug.deprecated('pc.Texture#rgbm is deprecated. Use pc.Texture#type instead.');
this.type = rgbm ? TEXTURETYPE_RGBM : TEXTURETYPE_DEFAULT;
}
})
export { deprecated }
This would give a current list of deprecated members. Any thoughts @mvaligursky ?