diff --git a/docs/api/app.md b/docs/api/app.md index 03cbd62384e57..ea9071103fb5d 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -801,12 +801,12 @@ app.on('second-instance', (commandLine, workingDirectory) => { }) if (!gotTheLock) { - return app.quit() + app.quit() +} else { + // Create myWindow, load the rest of the app, etc... + app.on('ready', () => { + }) } - -// Create myWindow, load the rest of the app, etc... -app.on('ready', () => { -}) ``` ### `app.hasSingleInstanceLock()` diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index 679c2c96d58f1..a6cc511d6d644 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -110,10 +110,10 @@ for (let name of events) { } // TODO(MarshallOfSound): Remove in 4.0 -app.makeSingleInstance = (cb) => { +app.makeSingleInstance = (oldStyleFn) => { deprecate.warn('app.makeSingleInstance(cb)', 'app.requestSingleInstanceLock() and app.on(\'second-instance\', cb)') - if (cb && typeof cb === 'function') { - app.on('second-instance', (event, ...args) => cb(...args)) + if (oldStyleFn && typeof oldStyleFn === 'function') { + app.on('second-instance', (event, ...args) => oldStyleFn(...args)) } return !app.requestSingleInstanceLock() }