Export app before requiring modules
This commit is contained in:
		
					parent
					
						
							
								4dbdcad05e
							
						
					
				
			
			
				commit
				
					
						be642612c0
					
				
			
		
					 2 changed files with 8 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue