2018-09-13 16:10:51 +00:00
|
|
|
const { app } = require('electron')
|
2017-09-20 02:58:10 +00:00
|
|
|
|
2018-03-07 03:01:17 +00:00
|
|
|
app.once('ready', () => {
|
2018-09-13 16:10:51 +00:00
|
|
|
console.log('started') // ping parent
|
2018-03-07 03:01:17 +00:00
|
|
|
})
|
2017-09-20 02:58:10 +00:00
|
|
|
|
2018-05-07 15:29:18 +00:00
|
|
|
const gotTheLock = app.requestSingleInstanceLock()
|
|
|
|
|
2019-03-12 15:56:28 +00:00
|
|
|
app.on('second-instance', (event, args) => {
|
|
|
|
setImmediate(() => {
|
|
|
|
console.log(JSON.stringify(args))
|
|
|
|
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)
|
|
|
|
}
|