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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
373 B
JavaScript
Raw Normal View History

2018-09-13 16:10:51 +00:00
const { app } = require('electron');
app.whenReady().then(() => {
2018-09-13 16:10:51 +00:00
console.log('started'); // ping parent
});
const gotTheLock = app.requestSingleInstanceLock();
app.on('second-instance', (event, args, workingDirectory) => {
setImmediate(() => {
console.log(JSON.stringify(args), workingDirectory);
app.exit(0);
});
});
if (!gotTheLock) {
app.exit(1);
}