electron/spec/fixtures/api/singleton/main.js

19 lines
355 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
const { app } = require('electron');
app.whenReady().then(() => {
2020-03-20 20:28:31 +00:00
console.log('started'); // ping parent
});
2020-03-20 20:28:31 +00:00
const gotTheLock = app.requestSingleInstanceLock();
app.on('second-instance', (event, args, workingDirectory) => {
setImmediate(() => {
console.log(JSON.stringify(args));
2020-03-20 20:28:31 +00:00
app.exit(0);
});
});
if (!gotTheLock) {
2020-03-20 20:28:31 +00:00
app.exit(1);
}