Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit de05a76

Browse files
committed
Replace deprecated app.makeSingleInstance() with app.requestSingleInstanceLock()
1 parent 21172fb commit de05a76

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

public/electron.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ app.on('quit', () => {
226226
});
227227

228228
// Prevent multiple instances of the application.
229-
const duplicateInstance = app.makeSingleInstance(args => {
229+
const gotTheLock = app.requestSingleInstanceLock();
230+
if (!gotTheLock) app.quit();
231+
app.on('second-instance', (event, args) => {
230232
if (process.platform == 'win32') {
231233
const protocolUrl = args && args.slice(1)[0];
232234
if (protocolUrl) onOpenUrl(null, protocolUrl);
@@ -236,7 +238,6 @@ const duplicateInstance = app.makeSingleInstance(args => {
236238
win.focus();
237239
}
238240
});
239-
if (duplicateInstance) app.quit();
240241

241242
app.setAsDefaultProtocolClient(PREFIX_NAME);
242243
const onOpenUrl = async (event, url) => {

0 commit comments

Comments
 (0)