2017-09-20 02:58:10 +00:00
|
|
|
const {app} = require('electron')
|
|
|
|
|
2018-03-07 03:01:17 +00:00
|
|
|
app.once('ready', () => {
|
|
|
|
console.log('started') // ping parent
|
|
|
|
})
|
2017-09-20 02:58:10 +00:00
|
|
|
|
2018-05-07 15:29:18 +00:00
|
|
|
const gotTheLock = app.requestSingleInstanceLock()
|
|
|
|
|
|
|
|
app.on('second-instance', () => {
|
|
|
|
setImmediate(() => app.exit(0))
|
2017-09-20 02:58:10 +00:00
|
|
|
})
|
|
|
|
|
2018-05-07 15:29:18 +00:00
|
|
|
if (!gotTheLock) {
|
2017-09-20 02:58:10 +00:00
|
|
|
app.exit(1)
|
|
|
|
}
|