mirror of
https://github.com/electron/electron.git
synced 2026-01-29 09:18:18 -05:00
* Refactor app.makeSingleInstance
* new API `app.isPrimaryInstance()`
* new API `app.isSingleInstance()`
* new event `app.on('second-instance')`
* deprecated old syntax `app.makeSingleInstance(cb)`
* deprecated old syntax of `app.makeSingleInstance() --> bool` in favor
of `app.isPrimaryInstance()`
* Fix spec, we don't need process.nextTick hacks any more
* Make deprecation TODO for the return value of makeSingleInstance
* Refactor makeSingleInstance to requestSingleInstanceLock and add appropriate deprecation comments
* I swear this isn't tricking the linter
* Make const
* Add deprecation warnings for release, and add to planned-breaking-changes
BREAKING CHANGE
16 lines
265 B
JavaScript
16 lines
265 B
JavaScript
const {app} = require('electron')
|
|
|
|
app.once('ready', () => {
|
|
console.log('started') // ping parent
|
|
})
|
|
|
|
const gotTheLock = app.requestSingleInstanceLock()
|
|
|
|
app.on('second-instance', () => {
|
|
setImmediate(() => app.exit(0))
|
|
})
|
|
|
|
if (!gotTheLock) {
|
|
app.exit(1)
|
|
}
|