1 Star 0 Fork 70

zhubanghao/Electron快速开发框架

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.js 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
小狄子 提交于 2019-01-05 11:54 . Release1.0
/*主进程*/
//用于维护electron声明周期的组件
const { app } = require('electron');
const logger = require('./common/Logger');
const helper = require('./process/MainProcessHelper');
/* ↓app对象生命周期维护开始↓ */
/**
* app对象生命周期及事件
* @see https://electronjs.org/docs/api/app
*/
// 这个方法将会在electron初始化完成后被调用
// 某些API只能在初始化之后(此状态之后)被调用
app.on('ready', helper.createWindow)
// 当所有窗口关闭时关闭应用程序
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
logger.info("点击窗口关闭按钮");
app.quit();
}
})
//当应用程序准备退出时执行动作
app.on('will-quit', () => {
logger.info("程序即将退出");
});
//当应用程序激活时,通常在macOS下
app.on('activate', function () {
//如果当前没有窗口被激活,则创建窗口
if (helper.getMainWindow() === null) {
helper.createWindow()
}
})
/* ↑app对象生命周期维护结束↑ */
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
NodeJS
1
https://gitee.com/zhubanghaoypl/electron-quick-start-framework.git
git@gitee.com:zhubanghaoypl/electron-quick-start-framework.git
zhubanghaoypl
electron-quick-start-framework
Electron快速开发框架
master

搜索帮助