Replace deprecated app.makeSingleInstance() with app.requestSingleInstanceLock()

parent 21172fb9
...@@ -226,7 +226,9 @@ app.on('quit', () => { ...@@ -226,7 +226,9 @@ app.on('quit', () => {
}); });
// Prevent multiple instances of the application. // Prevent multiple instances of the application.
const duplicateInstance = app.makeSingleInstance(args => { const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) app.quit();
app.on('second-instance', (event, args) => {
if (process.platform == 'win32') { if (process.platform == 'win32') {
const protocolUrl = args && args.slice(1)[0]; const protocolUrl = args && args.slice(1)[0];
if (protocolUrl) onOpenUrl(null, protocolUrl); if (protocolUrl) onOpenUrl(null, protocolUrl);
...@@ -236,7 +238,6 @@ const duplicateInstance = app.makeSingleInstance(args => { ...@@ -236,7 +238,6 @@ const duplicateInstance = app.makeSingleInstance(args => {
win.focus(); win.focus();
} }
}); });
if (duplicateInstance) app.quit();
app.setAsDefaultProtocolClient(PREFIX_NAME); app.setAsDefaultProtocolClient(PREFIX_NAME);
const onOpenUrl = async (event, url) => { const onOpenUrl = async (event, url) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment