autoformat more files
This commit is contained in:
parent
2fb92076b6
commit
67d189474c
2 changed files with 16 additions and 17 deletions
|
@ -15,7 +15,7 @@ exports.load = function (appUrl) {
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
useContentSize: true,
|
useContentSize: true
|
||||||
})
|
})
|
||||||
mainWindow.loadURL(appUrl)
|
mainWindow.loadURL(appUrl)
|
||||||
mainWindow.focus()
|
mainWindow.focus()
|
||||||
|
|
|
@ -13,23 +13,23 @@ const url = require('url')
|
||||||
var argv = process.argv.slice(1)
|
var argv = process.argv.slice(1)
|
||||||
var option = { file: null, help: null, version: null, webdriver: null, modules: [] }
|
var option = { file: null, help: null, version: null, webdriver: null, modules: [] }
|
||||||
for (var i = 0; i < argv.length; i++) {
|
for (var i = 0; i < argv.length; i++) {
|
||||||
if (argv[i] == '--version' || argv[i] == '-v') {
|
if (argv[i] === '--version' || argv[i] === '-v') {
|
||||||
option.version = true
|
option.version = true
|
||||||
break
|
break
|
||||||
} else if (argv[i].match(/^--app=/)) {
|
} else if (argv[i].match(/^--app=/)) {
|
||||||
option.file = argv[i].split('=')[1]
|
option.file = argv[i].split('=')[1]
|
||||||
break
|
break
|
||||||
} else if (argv[i] == '--help' || argv[i] == '-h') {
|
} else if (argv[i] === '--help' || argv[i] === '-h') {
|
||||||
option.help = true
|
option.help = true
|
||||||
break
|
break
|
||||||
} else if (argv[i] == '--interactive' || argv[i] == '-i') {
|
} else if (argv[i] === '--interactive' || argv[i] === '-i') {
|
||||||
option.interactive = true
|
option.interactive = true
|
||||||
} else if (argv[i] == '--test-type=webdriver') {
|
} else if (argv[i] === '--test-type=webdriver') {
|
||||||
option.webdriver = true
|
option.webdriver = true
|
||||||
} else if (argv[i] == '--require' || argv[i] == '-r') {
|
} else if (argv[i] === '--require' || argv[i] === '-r') {
|
||||||
option.modules.push(argv[++i])
|
option.modules.push(argv[++i])
|
||||||
continue
|
continue
|
||||||
} else if (argv[i][0] == '-') {
|
} else if (argv[i][0] === '-') {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
option.file = argv[i]
|
option.file = argv[i]
|
||||||
|
@ -39,14 +39,14 @@ for (var i = 0; i < argv.length; i++) {
|
||||||
|
|
||||||
// Quit when all windows are closed and no other one is listening to this.
|
// Quit when all windows are closed and no other one is listening to this.
|
||||||
app.on('window-all-closed', function () {
|
app.on('window-all-closed', function () {
|
||||||
if (app.listeners('window-all-closed').length == 1 && !option.interactive)
|
if (app.listeners('window-all-closed').length === 1 && !option.interactive) {
|
||||||
app.quit()
|
app.quit()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create default menu.
|
// Create default menu.
|
||||||
app.once('ready', function () {
|
app.once('ready', function () {
|
||||||
if (Menu.getApplicationMenu())
|
if (Menu.getApplicationMenu()) return
|
||||||
return
|
|
||||||
|
|
||||||
var template = [
|
var template = [
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ app.once('ready', function () {
|
||||||
label: 'Select All',
|
label: 'Select All',
|
||||||
accelerator: 'CmdOrCtrl+A',
|
accelerator: 'CmdOrCtrl+A',
|
||||||
role: 'selectall'
|
role: 'selectall'
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -94,14 +94,13 @@ app.once('ready', function () {
|
||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
accelerator: 'CmdOrCtrl+R',
|
accelerator: 'CmdOrCtrl+R',
|
||||||
click: function (item, focusedWindow) {
|
click: function (item, focusedWindow) {
|
||||||
if (focusedWindow)
|
if (focusedWindow) focusedWindow.reload()
|
||||||
focusedWindow.reload()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle Full Screen',
|
label: 'Toggle Full Screen',
|
||||||
accelerator: (function () {
|
accelerator: (function () {
|
||||||
if (process.platform == 'darwin')
|
if (process.platform === 'darwin')
|
||||||
return 'Ctrl+Command+F'
|
return 'Ctrl+Command+F'
|
||||||
else
|
else
|
||||||
return 'F11'
|
return 'F11'
|
||||||
|
@ -114,7 +113,7 @@ app.once('ready', function () {
|
||||||
{
|
{
|
||||||
label: 'Toggle Developer Tools',
|
label: 'Toggle Developer Tools',
|
||||||
accelerator: (function () {
|
accelerator: (function () {
|
||||||
if (process.platform == 'darwin')
|
if (process.platform === 'darwin')
|
||||||
return 'Alt+Command+I'
|
return 'Alt+Command+I'
|
||||||
else
|
else
|
||||||
return 'Ctrl+Shift+I'
|
return 'Ctrl+Shift+I'
|
||||||
|
@ -176,7 +175,7 @@ app.once('ready', function () {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
if (process.platform == 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
template.unshift({
|
template.unshift({
|
||||||
label: 'Electron',
|
label: 'Electron',
|
||||||
submenu: [
|
submenu: [
|
||||||
|
@ -259,7 +258,7 @@ function loadApplicationPackage (packagePath) {
|
||||||
// Run the app.
|
// Run the app.
|
||||||
require('module')._load(packagePath, module, true)
|
require('module')._load(packagePath, module, true)
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if (e.code == 'MODULE_NOT_FOUND') {
|
if (e.code === 'MODULE_NOT_FOUND') {
|
||||||
app.focus()
|
app.focus()
|
||||||
dialog.showErrorBox(
|
dialog.showErrorBox(
|
||||||
'Error opening app',
|
'Error opening app',
|
||||||
|
|
Loading…
Reference in a new issue