electron/spec/fixtures/api/singleton/main.js
Jeremy Apthorp ea6a926494 test: add test for second-instance event parameter (#16798)
* test: add test for second-instance event parameter

* robustify getting data from child process

* fix test on windows

* fix lint

* Update api-app-spec.js

* fix package-lock.json
2019-03-12 11:56:28 -04:00

18 lines
325 B
JavaScript

const { app } = require('electron')
app.once('ready', () => {
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)
}