Create app.md
This commit is contained in:
parent
b328a238a6
commit
1a6f6fd497
1 changed files with 6 additions and 6 deletions
|
@ -674,9 +674,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
|
single instance of your app is running, and other instances signal this
|
||||||
instance and exit.
|
instance and exit.
|
||||||
|
|
||||||
`callback` will be called with `callback(argv, workingDirectory)` when a second
|
`callback` will be called by the first instance with `callback(argv, workingDirectory)`
|
||||||
instance has been executed. `argv` is an Array of the second instance's command
|
when a second instance has been executed. `argv` is an Array of the second instance's
|
||||||
line arguments, and `workingDirectory` is its current working directory. Usually
|
command line arguments, and `workingDirectory` is its current working directory. Usually
|
||||||
applications respond to this by making their primary window focused and
|
applications respond to this by making their primary window focused and
|
||||||
non-minimized.
|
non-minimized.
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ starts:
|
||||||
const {app} = require('electron')
|
const {app} = require('electron')
|
||||||
let myWindow = null
|
let myWindow = null
|
||||||
|
|
||||||
const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
|
const isNotFirstInstance = app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||||
// Someone tried to run a second instance, we should focus our window.
|
// Someone tried to run a second instance, we should focus our window.
|
||||||
if (myWindow) {
|
if (myWindow) {
|
||||||
if (myWindow.isMinimized()) myWindow.restore()
|
if (myWindow.isMinimized()) myWindow.restore()
|
||||||
|
@ -709,8 +709,8 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (shouldQuit) {
|
if (isNotFirstInstance) {
|
||||||
app.quit()
|
app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create myWindow, load the rest of the app, etc...
|
// Create myWindow, load the rest of the app, etc...
|
||||||
|
|
Loading…
Reference in a new issue