commit
a916be3ffd
1 changed files with 5 additions and 5 deletions
|
@ -684,9 +684,9 @@ allowing multiple instances of your app to run, this will ensure that only a
|
|||
single instance of your app is running, and other instances signal this
|
||||
instance and exit.
|
||||
|
||||
`callback` will be called with `callback(argv, workingDirectory)` when a second
|
||||
instance has been executed. `argv` is an Array of the second instance's command
|
||||
line arguments, and `workingDirectory` is its current working directory. Usually
|
||||
`callback` will be called by the first instance with `callback(argv, workingDirectory)`
|
||||
when a second instance has been executed. `argv` is an Array of the second instance's
|
||||
command line arguments, and `workingDirectory` is its current working directory. Usually
|
||||
applications respond to this by making their primary window focused and
|
||||
non-minimized.
|
||||
|
||||
|
@ -711,7 +711,7 @@ starts:
|
|||
const {app} = require('electron')
|
||||
let myWindow = null
|
||||
|
||||
const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||
const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (myWindow) {
|
||||
if (myWindow.isMinimized()) myWindow.restore()
|
||||
|
@ -719,7 +719,7 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
|
|||
}
|
||||
})
|
||||
|
||||
if (shouldQuit) {
|
||||
if (isSecondInstance) {
|
||||
app.quit()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue