mirror of
https://github.com/electron/electron.git
synced 2026-01-14 09:58:04 -05:00
19 lines
373 B
JavaScript
19 lines
373 B
JavaScript
const { app } = require('electron');
|
|
|
|
app.whenReady().then(() => {
|
|
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);
|
|
}
|