electron/spec/fixtures/api/singleton/main.js
2020-03-20 13:28:31 -07:00

18 lines
337 B
JavaScript

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