Main: Minor changes

This commit is contained in:
Svallinn 2021-07-03 03:44:23 +01:00
parent 2ce3110041
commit d8d601cc08
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
1 changed files with 5 additions and 5 deletions

View File

@ -247,7 +247,7 @@ function runApp() {
} }
// Show when loaded // Show when loaded
newWindow.on('ready-to-show', () => { newWindow.once('ready-to-show', () => {
newWindow.show() newWindow.show()
newWindow.focus() newWindow.focus()
}) })
@ -281,13 +281,13 @@ function runApp() {
}) })
} }
ipcMain.on('appReady', () => { ipcMain.once('appReady', () => {
if (startupUrl) { if (startupUrl) {
mainWindow.webContents.send('openUrl', startupUrl) mainWindow.webContents.send('openUrl', startupUrl)
} }
}) })
ipcMain.on('relaunchRequest', () => { ipcMain.once('relaunchRequest', () => {
if (isDev) { if (isDev) {
app.exit(parseInt(process.env.FREETUBE_RELAUNCH_EXIT_CODE)) app.exit(parseInt(process.env.FREETUBE_RELAUNCH_EXIT_CODE))
return return
@ -383,7 +383,7 @@ function runApp() {
child.unref() child.unref()
}) })
app.on('window-all-closed', () => { app.once('window-all-closed', () => {
// Clear cache and storage if it's the last window // Clear cache and storage if it's the last window
session.defaultSession.clearCache() session.defaultSession.clearCache()
session.defaultSession.clearStorageData({ session.defaultSession.clearStorageData({
@ -405,7 +405,7 @@ function runApp() {
}) })
app.on('activate', () => { app.on('activate', () => {
if (mainWindow === null || mainWindow === undefined) { if (BrowserWindow.getAllWindows().length === 0) {
createWindow() createWindow()
} }
}) })