Update to Electron 4.x
This commit is contained in:
parent
667b2e63f1
commit
ae161c6cf6
10 changed files with 74 additions and 60 deletions
37
main.js
37
main.js
|
@ -98,21 +98,22 @@ function showWindow() {
|
|||
|
||||
if (!process.mas) {
|
||||
console.log('making app single instance');
|
||||
const shouldQuit = app.makeSingleInstance(() => {
|
||||
// Someone tried to run a second instance, we should focus our window
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) {
|
||||
mainWindow.restore();
|
||||
}
|
||||
|
||||
showWindow();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (shouldQuit) {
|
||||
const gotLock = app.requestSingleInstanceLock();
|
||||
if (!gotLock) {
|
||||
console.log('quitting; we are the second instance');
|
||||
app.exit();
|
||||
} else {
|
||||
app.on('second-instance', () => {
|
||||
// Someone tried to run a second instance, we should focus our window
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) {
|
||||
mainWindow.restore();
|
||||
}
|
||||
|
||||
showWindow();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +218,7 @@ function createWindow() {
|
|||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
nodeIntegrationInWorker: false,
|
||||
// sandbox: true,
|
||||
contextIsolation: false,
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
nativeWindowOpen: true,
|
||||
},
|
||||
|
@ -444,8 +445,8 @@ function showAbout() {
|
|||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
nodeIntegrationInWorker: false,
|
||||
contextIsolation: false,
|
||||
preload: path.join(__dirname, 'about_preload.js'),
|
||||
// sandbox: true,
|
||||
nativeWindowOpen: true,
|
||||
},
|
||||
parent: mainWindow,
|
||||
|
@ -490,8 +491,8 @@ async function showSettingsWindow() {
|
|||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
nodeIntegrationInWorker: false,
|
||||
contextIsolation: false,
|
||||
preload: path.join(__dirname, 'settings_preload.js'),
|
||||
// sandbox: true,
|
||||
nativeWindowOpen: true,
|
||||
},
|
||||
parent: mainWindow,
|
||||
|
@ -535,8 +536,8 @@ async function showDebugLogWindow() {
|
|||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
nodeIntegrationInWorker: false,
|
||||
contextIsolation: false,
|
||||
preload: path.join(__dirname, 'debug_log_preload.js'),
|
||||
// sandbox: true,
|
||||
nativeWindowOpen: true,
|
||||
},
|
||||
parent: mainWindow,
|
||||
|
@ -583,8 +584,8 @@ async function showPermissionsPopupWindow() {
|
|||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
nodeIntegrationInWorker: false,
|
||||
contextIsolation: false,
|
||||
preload: path.join(__dirname, 'permissions_popup_preload.js'),
|
||||
// sandbox: true,
|
||||
nativeWindowOpen: true,
|
||||
},
|
||||
parent: mainWindow,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue