2020-03-20 20:28:31 +00:00
|
|
|
const { app } = require('electron');
|
2017-09-20 02:58:10 +00:00
|
|
|
|
2020-02-03 22:43:22 +00:00
|
|
|
app.whenReady().then(() => {
|
2020-03-20 20:28:31 +00:00
|
|
|
console.log('started'); // ping parent
|
|
|
|
});
|
2017-09-20 02:58:10 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const gotTheLock = app.requestSingleInstanceLock();
|
2018-05-07 15:29:18 +00:00
|
|
|
|
2019-03-12 15:56:28 +00:00
|
|
|
app.on('second-instance', (event, args) => {
|
|
|
|
setImmediate(() => {
|
2020-03-20 20:28:31 +00:00
|
|
|
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) {
|
2020-03-20 20:28:31 +00:00
|
|
|
app.exit(1);
|
2017-09-20 02:58:10 +00:00
|
|
|
}
|