From 1a6f6fd49730c474b27ca329f8f75df8d317ef06 Mon Sep 17 00:00:00 2001 From: Thomas Hofmann Date: Wed, 14 Jun 2017 12:12:30 +0200 Subject: [PATCH 1/2] Create app.md --- docs/api/app.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index 784b20a47301..c2090a68e662 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -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 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. @@ -701,7 +701,7 @@ starts: const {app} = require('electron') 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. if (myWindow) { if (myWindow.isMinimized()) myWindow.restore() @@ -709,8 +709,8 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { } }) -if (shouldQuit) { - app.quit() +if (isNotFirstInstance) { + app.quit(); } // Create myWindow, load the rest of the app, etc... From da001940e2dc7db7ef697e8dabb976075c2690f6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 26 Jun 2017 08:53:29 -0700 Subject: [PATCH 2/2] isNotFirstInstance -> isSecondInstance --- docs/api/app.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index c2090a68e662..395bb3f36d20 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -701,7 +701,7 @@ starts: const {app} = require('electron') let myWindow = null -const isNotFirstInstance = 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() @@ -709,8 +709,8 @@ const isNotFirstInstance = app.makeSingleInstance((commandLine, workingDirectory } }) -if (isNotFirstInstance) { - app.quit(); +if (isSecondInstance) { + app.quit() } // Create myWindow, load the rest of the app, etc...