refactor: make applicationMenu a property on app (#17361)
This commit is contained in:
parent
d412582f72
commit
0431997c8d
4 changed files with 25 additions and 1 deletions
|
@ -19,9 +19,11 @@ Object.setPrototypeOf(App.prototype, EventEmitter.prototype)
|
|||
EventEmitter.call(app as any)
|
||||
|
||||
Object.assign(app, {
|
||||
// TODO(codebytere): remove in 7.0
|
||||
setApplicationMenu (menu: Electron.Menu | null) {
|
||||
return Menu.setApplicationMenu(menu)
|
||||
},
|
||||
// TODO(codebytere): remove in 7.0
|
||||
getApplicationMenu () {
|
||||
return Menu.getApplicationMenu()
|
||||
},
|
||||
|
@ -38,6 +40,17 @@ Object.assign(app, {
|
|||
|
||||
app.getFileIcon = deprecate.promisify(app.getFileIcon)
|
||||
|
||||
// we define this here because it'd be overly complicated to
|
||||
// do in native land
|
||||
Object.defineProperty(app, 'applicationMenu', {
|
||||
get () {
|
||||
return Menu.getApplicationMenu()
|
||||
},
|
||||
set (menu: Electron.Menu | null) {
|
||||
return Menu.setApplicationMenu(menu)
|
||||
}
|
||||
})
|
||||
|
||||
app.isPackaged = (() => {
|
||||
const execFile = path.basename(process.execPath).toLowerCase()
|
||||
if (process.platform === 'win32') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue