-
-
Notifications
You must be signed in to change notification settings - Fork 479
/
Copy pathapp.js
37 lines (32 loc) · 906 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { app } from 'electron'
import { initializeApp } from './electron/utils/initialize.js'
function start() {
let previewWindow = null
let tourWindow = null
let mainWindow = null
app.on('ready', () => {
const windows = initializeApp()
tourWindow = windows.tourWindow
mainWindow = windows.mainWindow
previewWindow = windows.previewWindow
})
app.on('activate', async () => {
try {
const { showWindow } = await import('./main/tour.js')
showWindow('activate')
} catch (error) {
console.error('Error during app activation:', error)
}
})
// Clean up before quitting
app.on('before-quit', () => {
try {
if (tourWindow) tourWindow.destroy()
if (mainWindow) mainWindow.destroy()
if (previewWindow) previewWindow.destroy()
} catch (error) {
console.error('Error during app cleanup:', error)
}
})
}
start()