diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index 09835a792e0e..34210f42090f 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -1,12 +1,15 @@ 'use strict' +const bindings = process.atomBinding('app') +const {app} = bindings + +// Only one app object permitted. +module.exports = app + const electron = require('electron') const {deprecate, Menu} = electron const {EventEmitter} = require('events') -const bindings = process.atomBinding('app') -const {app} = bindings - Object.setPrototypeOf(app, EventEmitter.prototype) let appPath = null @@ -67,6 +70,3 @@ process.atomBinding('download_item')._setWrapDownloadItem((downloadItem) => { // downloadItem is an EventEmitter. Object.setPrototypeOf(downloadItem, EventEmitter.prototype) }) - -// Only one App object pemitted. -module.exports = app diff --git a/lib/browser/api/menu-item-roles.js b/lib/browser/api/menu-item-roles.js index aaebd56223b4..0df6126a15f4 100644 --- a/lib/browser/api/menu-item-roles.js +++ b/lib/browser/api/menu-item-roles.js @@ -1,7 +1,8 @@ +const {app} = require('electron') + const roles = { about: { get label () { - const {app} = require('electron') return `About ${app.getName()}` } }, @@ -33,7 +34,6 @@ const roles = { }, hide: { get label () { - const {app} = require('electron') return `Hide ${app.getName()}` }, accelerator: 'Command+H' @@ -59,7 +59,6 @@ const roles = { }, quit: { get label () { - const {app} = require('electron') return process.platform === 'win32' ? 'Exit' : `Quit ${app.getName()}` }, accelerator: process.platform === 'win32' ? null : 'Command+Q', @@ -120,7 +119,6 @@ exports.execute = function (role, focusedWindow) { const {appMethod, webContentsMethod, windowMethod} = roles[role] if (appMethod) { - const {app} = require('electron') app[appMethod]() return true }