Make a single instance of app 🎯

This commit is contained in:
Akash Nimare
2016-09-10 10:26:28 +05:30
committed by GitHub
parent d62b87ec0c
commit e12ad6e1d5

View File

@@ -30,6 +30,20 @@ let targetLink;
// Load this url in main window
const targetUrl = 'file://' + path.join(__dirname, '../renderer', 'index.html');
const isAlreadyRunning = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.show();
}
});
if (isAlreadyRunning) {
app.quit();
}
function checkWindowURL() {
if (data.domain !== undefined) {
return data.domain;