Created
October 18, 2016 09:53
-
-
Save jbleuzen/3ab2ec5bae831a0b984036b463812fa9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {app} = require('electron') | |
let myWindow = null | |
const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { | |
// Someone tried to run a second instance, we should focus our window. | |
// | |
// | |
// ------> We should parse commandLine to retrieve open URI | |
// | |
// | |
if (myWindow) { | |
if (myWindow.isMinimized()) myWindow.restore() | |
myWindow.focus() | |
} | |
}) | |
if (shouldQuit) { | |
app.quit() | |
} | |
// Create myWindow, load the rest of the app, etc... | |
app.on('ready', () => { | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment