1 Star 0 Fork 0

阿易/electron_react

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.js 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
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()
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wxs25789/electron_react.git
git@gitee.com:wxs25789/electron_react.git
wxs25789
electron_react
electron_react
master

搜索帮助