electron/spec/fixtures/api/singleton/main.js
Raymond Zhao 9e0e04da25
fix: second-instance additionalData parameter (#31661)
* test: second-instance additionalData parameter

* Fix posix implementation
2021-11-04 01:14:09 -07:00

18 lines
355 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));
app.exit(0);
});
});
if (!gotTheLock) {
app.exit(1);
}