From d8d601cc08f6c3038e19a827a17ad135fad0e3f5 Mon Sep 17 00:00:00 2001 From: Svallinn <41585298+Svallinn@users.noreply.github.com> Date: Sat, 3 Jul 2021 03:44:23 +0100 Subject: [PATCH] Main: Minor changes --- src/main/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 38381e95..0fa7564f 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -247,7 +247,7 @@ function runApp() { } // Show when loaded - newWindow.on('ready-to-show', () => { + newWindow.once('ready-to-show', () => { newWindow.show() newWindow.focus() }) @@ -281,13 +281,13 @@ function runApp() { }) } - ipcMain.on('appReady', () => { + ipcMain.once('appReady', () => { if (startupUrl) { mainWindow.webContents.send('openUrl', startupUrl) } }) - ipcMain.on('relaunchRequest', () => { + ipcMain.once('relaunchRequest', () => { if (isDev) { app.exit(parseInt(process.env.FREETUBE_RELAUNCH_EXIT_CODE)) return @@ -383,7 +383,7 @@ function runApp() { child.unref() }) - app.on('window-all-closed', () => { + app.once('window-all-closed', () => { // Clear cache and storage if it's the last window session.defaultSession.clearCache() session.defaultSession.clearStorageData({ @@ -405,7 +405,7 @@ function runApp() { }) app.on('activate', () => { - if (mainWindow === null || mainWindow === undefined) { + if (BrowserWindow.getAllWindows().length === 0) { createWindow() } })