fix: deprecate properties in app.getAppMetrics() (#13446)

* fix: deprecate properties in app.getAppMetrics()

* address feedback from review

* fix deprecated property location

* simplify test
This commit is contained in:
Shelley Vohr 2018-06-26 23:47:01 -07:00 committed by GitHub
parent 08ccc2d624
commit f9e2ec43d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 6 deletions

View file

@ -58,6 +58,13 @@ Object.assign(app, {
}
})
const nativeFn = app.getAppMetrics
app.getAppMetrics = () => {
deprecate.removeProperty(nativeFn, 'privateBytes')
deprecate.removeProperty(nativeFn, 'sharedBytes')
return nativeFn.call(app)
}
app.isPackaged = (() => {
const execFile = path.basename(process.execPath).toLowerCase()
if (process.platform === 'win32') {

View file

@ -88,8 +88,14 @@ deprecate.getHandler = () => deprecationHandler
// }
// }
// Deprecate the old name of a property
deprecate.property = (object, deprecatedName, newName) => {
deprecate.removeProperty = (object, deprecatedName) => {
if (!process.noDeprecation) {
deprecate.log(`The '${deprecatedName}' property has been deprecated.`)
}
}
// Replace the old name of a property
deprecate.renameProperty = (object, deprecatedName, newName) => {
let warned = false
let warn = () => {
if (!(warned || process.noDeprecation)) {