2023-08-28 11:23:10 +00:00
|
|
|
const { app, BrowserWindow, ipcMain, shell } = require('electron/main')
|
2023-08-29 19:52:16 +00:00
|
|
|
const path = require('node:path')
|
2019-11-01 15:04:47 +00:00
|
|
|
|
2023-08-14 08:04:29 +00:00
|
|
|
let mainWindow = null
|
|
|
|
|
|
|
|
ipcMain.handle('get-app-path', (event) => app.getAppPath())
|
|
|
|
|
|
|
|
function createWindow () {
|
|
|
|
const windowOptions = {
|
|
|
|
width: 600,
|
|
|
|
height: 400,
|
|
|
|
title: 'Get app information',
|
|
|
|
webPreferences: {
|
2023-08-29 19:52:16 +00:00
|
|
|
preload: path.join(__dirname, 'preload.js')
|
2023-08-14 08:04:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mainWindow = new BrowserWindow(windowOptions)
|
|
|
|
mainWindow.loadFile('index.html')
|
|
|
|
|
|
|
|
mainWindow.on('closed', () => {
|
|
|
|
mainWindow = null
|
|
|
|
})
|
|
|
|
|
|
|
|
// Open external links in the default browser
|
|
|
|
mainWindow.webContents.on('will-navigate', (event, url) => {
|
|
|
|
event.preventDefault()
|
|
|
|
shell.openExternal(url)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
app.whenReady().then(() => {
|
|
|
|
createWindow()
|
2023-04-05 13:42:20 +00:00
|
|
|
})
|