代码拉取完成,页面将自动刷新
const { app, BrowserWindow } = require('electron');
const {default: installExtension, REACT_DEVELOPER_TOOLS } = require('electron-devtools-installer')
const path = require("node:path")
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, 'preload.js')
}
});
win.loadFile('./dist/index.html');
}
app.whenReady().then(() => {
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred:', err))
createWindow();
// macOS 生效,如果没有打开窗口时,新建一个窗口
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
});
app.on('window-all-closed', () => {
// 关闭所有窗口时,退出应用,windows(32) 和 Linux 生效
if (process.platform !== 'darwin') {
app.quit()
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。