Commit 4e3799a9 authored by 神楽坂玲奈's avatar 神楽坂玲奈

deps

parent 025b5d2f
...@@ -38,7 +38,13 @@ const path = require('path'); ...@@ -38,7 +38,13 @@ const path = require('path');
let mainWindow; let mainWindow;
// 单实例 // 单实例
const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
}
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window. // Someone tried to run a second instance, we should focus our window.
if (mainWindow) { if (mainWindow) {
if (mainWindow.isMinimized()) { if (mainWindow.isMinimized()) {
...@@ -49,10 +55,7 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { ...@@ -49,10 +55,7 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
} }
mainWindow.focus(); mainWindow.focus();
} }
}); })
if (shouldQuit) {
app.quit();
}
// 调试模式 // 调试模式
if (!process.env['NODE_ENV']) { if (!process.env['NODE_ENV']) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment