mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: remove only on deprecations api spec (#14564)
* chore: remove only * add option to ignore missing properties
This commit is contained in:
@@ -44,7 +44,7 @@ const nativeFn = app.getAppMetrics
|
||||
app.getAppMetrics = () => {
|
||||
let metrics = nativeFn.call(app)
|
||||
for (const metric of metrics) {
|
||||
deprecate.removeProperty(metric, 'memory')
|
||||
deprecate.removeProperty(metric, 'memory', true)
|
||||
}
|
||||
|
||||
return metrics
|
||||
|
||||
@@ -63,7 +63,7 @@ const deprecate = {
|
||||
this.emit(oldName, ...args)
|
||||
})
|
||||
},
|
||||
removeProperty: (object, deprecated) => {
|
||||
removeProperty: (object, deprecated, ignoreMissingProps = false) => {
|
||||
let warned = false
|
||||
let warn = () => {
|
||||
if (!(warned || process.noDeprecation)) {
|
||||
@@ -73,6 +73,7 @@ const deprecate = {
|
||||
}
|
||||
|
||||
if (!(deprecated in object)) {
|
||||
if (ignoreMissingProps) return
|
||||
throw new Error('Cannot deprecate a property on an object which does not have that property')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user