2023-04-05 13:42:20 +00:00
|
|
|
const { app, BrowserWindow, ipcMain } = require('electron')
|
2022-02-09 16:00:05 +00:00
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
function createWindow () {
|
|
|
|
const mainWindow = new BrowserWindow({
|
|
|
|
webPreferences: {
|
|
|
|
preload: path.join(__dirname, 'preload.js')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
ipcMain.on('set-title', (event, title) => {
|
|
|
|
const webContents = event.sender
|
|
|
|
const win = BrowserWindow.fromWebContents(webContents)
|
|
|
|
win.setTitle(title)
|
|
|
|
})
|
|
|
|
|
|
|
|
mainWindow.loadFile('index.html')
|
|
|
|
}
|
|
|
|
|
|
|
|
app.whenReady().then(() => {
|
|
|
|
createWindow()
|
2023-02-01 11:59:16 +00:00
|
|
|
|
2022-02-09 16:00:05 +00:00
|
|
|
app.on('activate', function () {
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('window-all-closed', function () {
|
|
|
|
if (process.platform !== 'darwin') app.quit()
|
|
|
|
})
|