2023-08-28 11:23:10 +00:00
|
|
|
const { app, BrowserWindow, shell } = require('electron/main')
|
2023-08-29 19:52:16 +00:00
|
|
|
const path = require('node:path')
|
2019-10-15 18:17:04 +00:00
|
|
|
|
|
|
|
let mainWindow = null
|
|
|
|
|
|
|
|
function createWindow () {
|
|
|
|
const windowOptions = {
|
|
|
|
width: 600,
|
|
|
|
height: 400,
|
|
|
|
title: 'Get version information',
|
|
|
|
webPreferences: {
|
2023-08-29 19:52:16 +00:00
|
|
|
preload: path.join(__dirname, 'preload.js')
|
2019-10-15 18:17:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mainWindow = new BrowserWindow(windowOptions)
|
|
|
|
mainWindow.loadFile('index.html')
|
|
|
|
|
|
|
|
mainWindow.on('closed', () => {
|
|
|
|
mainWindow = null
|
|
|
|
})
|
2023-08-08 10:35:59 +00:00
|
|
|
|
|
|
|
// Open external links in the default browser
|
|
|
|
mainWindow.webContents.on('will-navigate', (event, url) => {
|
|
|
|
event.preventDefault()
|
|
|
|
shell.openExternal(url)
|
|
|
|
})
|
2019-10-15 18:17:04 +00:00
|
|
|
}
|
|
|
|
|
2020-02-03 22:43:22 +00:00
|
|
|
app.whenReady().then(() => {
|
2019-10-15 18:17:04 +00:00
|
|
|
createWindow()
|
|
|
|
})
|