Force single instance application

This commit is contained in:
akshitkrnagpal 2018-07-12 03:53:40 +05:30 committed by Saúl Ibarra Corretgé
parent fae2c069b3
commit 26b55c7559

24
main.js
View file

@ -42,6 +42,30 @@ const indexURL = URL.format({
*/
let jitsiMeetWindow = null;
/**
* Force Single Instance Application
*/
const isSecondInstance = APP.makeSingleInstance(() => {
/**
* If someone creates second instance of the application, set focus on
* existing window.
*/
if (jitsiMeetWindow) {
if (jitsiMeetWindow.isMinimized()) {
jitsiMeetWindow.restore();
}
jitsiMeetWindow.focus();
}
});
/**
* We should quit the second instance.
*/
if (isSecondInstance) {
APP.quit();
process.exit(0);
}
/**
* Sets the APP object listeners.
*/