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