2023-09-13 10:13:51 +12:00
|
|
|
import { initialize } from '@electron/remote/main'
|
|
|
|
import { mainWindowCreation } from 'app/src-electron/mainScripts/mainWindowCreation'
|
|
|
|
import { app } from 'electron'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the app's Electron instance
|
|
|
|
*/
|
|
|
|
export const startApp = () => {
|
|
|
|
initialize()
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the singular app's window and make sure it is the only one
|
|
|
|
*/
|
|
|
|
export const openAppWindowManager = () => {
|
|
|
|
// Create the app window in the normal way
|
|
|
|
app.whenReady().then(mainWindowCreation)
|
|
|
|
|
2023-09-14 09:58:02 +12:00
|
|
|
// Create the app window, if it still doesn't exist yet
|
2023-09-13 10:13:51 +12:00
|
|
|
app.on('activate', () => {
|
2023-09-14 08:37:05 +12:00
|
|
|
mainWindowCreation()
|
2023-09-13 10:13:51 +12:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes the app's Electron instance when all windows are closed
|
|
|
|
*/
|
|
|
|
export const closeAppManager = (platform: string) => {
|
|
|
|
// Close app if we are on anything that isn't Mac
|
|
|
|
app.on('window-all-closed', () => {
|
|
|
|
if (platform !== 'darwin') {
|
|
|
|
app.quit()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|