2023-04-05 06:42:20 -07:00
|
|
|
const { app, BrowserWindow } = require('electron')
|
2023-07-17 10:30:53 +02:00
|
|
|
const path = require('node:path')
|
2022-06-22 04:17:48 -04:00
|
|
|
|
|
|
|
const createWindow = () => {
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
width: 800,
|
|
|
|
height: 600,
|
|
|
|
webPreferences: {
|
2023-04-05 06:42:20 -07:00
|
|
|
preload: path.join(__dirname, 'preload.js')
|
|
|
|
}
|
|
|
|
})
|
2022-06-22 04:17:48 -04:00
|
|
|
|
2023-04-05 06:42:20 -07:00
|
|
|
win.loadFile('index.html')
|
|
|
|
}
|
2022-06-22 04:17:48 -04:00
|
|
|
|
|
|
|
app.whenReady().then(() => {
|
2023-04-05 06:42:20 -07:00
|
|
|
createWindow()
|
2022-06-22 04:17:48 -04:00
|
|
|
|
|
|
|
app.on('activate', () => {
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
2023-04-05 06:42:20 -07:00
|
|
|
createWindow()
|
2022-06-22 04:17:48 -04:00
|
|
|
}
|
2023-04-05 06:42:20 -07:00
|
|
|
})
|
|
|
|
})
|
2022-06-22 04:17:48 -04:00
|
|
|
|
|
|
|
app.on('window-all-closed', () => {
|
|
|
|
if (process.platform !== 'darwin') {
|
2023-04-05 06:42:20 -07:00
|
|
|
app.quit()
|
2022-06-22 04:17:48 -04:00
|
|
|
}
|
2023-04-05 06:42:20 -07:00
|
|
|
})
|