mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix: prevent multiple app instances
This commit is contained in:
@ -6,6 +6,8 @@ import { format as formatUrl } from 'url';
|
|||||||
import ipcHandlers from './ipc-handlers';
|
import ipcHandlers from './ipc-handlers';
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
|
const gotTheLock = app.requestSingleInstanceLock();
|
||||||
|
|
||||||
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
|
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
|
||||||
|
|
||||||
// global reference to mainWindow (necessary to prevent window from being garbage collected)
|
// global reference to mainWindow (necessary to prevent window from being garbage collected)
|
||||||
@ -67,6 +69,9 @@ async function createMainWindow () {
|
|||||||
return window;
|
return window;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!gotTheLock)
|
||||||
|
app.quit();
|
||||||
|
else {
|
||||||
// Initialize ipcHandlers
|
// Initialize ipcHandlers
|
||||||
ipcHandlers();
|
ipcHandlers();
|
||||||
|
|
||||||
@ -87,3 +92,4 @@ app.on('activate', () => {
|
|||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
mainWindow = createMainWindow();
|
mainWindow = createMainWindow();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user