Merge pull request #12135 from electron/deprecate-getMenuBarHeight
deprecate screen.getMenuBarHeight
This commit is contained in:
commit
a3d4d461a3
3 changed files with 10 additions and 13 deletions
|
@ -9,6 +9,7 @@ namespace atom {
|
|||
|
||||
namespace api {
|
||||
|
||||
//TODO(codebytere): deprecated; remove in 3.0
|
||||
int Screen::getMenuBarHeight() {
|
||||
return [[NSApp mainMenu] menuBarHeight];
|
||||
}
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {deprecate} = require('electron')
|
||||
const {screen, Screen} = process.atomBinding('screen')
|
||||
|
||||
// Screen is an EventEmitter.
|
||||
Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(screen)
|
||||
|
||||
const nativeFn = screen.getMenuBarHeight
|
||||
screen.getMenuBarHeight = function () {
|
||||
if (!process.noDeprecations) {
|
||||
deprecate.warn('screen.getMenuBarHeight', 'screen.getPrimaryDisplay().workArea')
|
||||
}
|
||||
return nativeFn.call(this)
|
||||
}
|
||||
|
||||
module.exports = screen
|
||||
|
|
|
@ -18,17 +18,4 @@ describe('screen module', () => {
|
|||
assert(display.size.height > 0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('screen.getMenuBarHeight()', () => {
|
||||
before(function () {
|
||||
if (process.platform !== 'darwin') {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
|
||||
it('returns an integer', () => {
|
||||
const screenHeight = screen.getMenuBarHeight()
|
||||
assert.equal(typeof screenHeight, 'number')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue