1 Star 0 Fork 0

darkhorse / momento

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.js 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
lifangzhao 提交于 2020-09-29 16:36 . add project code.
const { app, BrowserWindow, Menu, screen, Tray } = require('electron');
require('electron-reload')(__dirname, {electron: './node_modules/electron'});
const createWindow = () => {
const { width, height } = screen.getPrimaryDisplay().workAreaSize;
Menu.setApplicationMenu(false);
window = new BrowserWindow({
width: 1280,
height: 800,
icon: './public/favicon.png',
webPreferences: {
nodeIntegration: true
}
});
window.on('minimize', e => {
e.preventDefault();
window.hide();
});
window.on('close', e => {
e.preventDefault();
window.hide();
});
window.loadFile('public/index.html');
};
let appIcon = null;
let window = null;
app.whenReady().then(createWindow)
app.on('window-all-closed', () => app.quit());
app.on('ready', () => {
appIcon = new Tray('public/favicon.png');
const contextMenu = Menu.buildFromTemplate([
{ label: '显示', click: () => window.show() },
{ label: '退出', click: () => {
window.destroy();
app.quit();
}}
]);
appIcon.setContextMenu(contextMenu);
});
1
https://gitee.com/darkhorse007/momento.git
git@gitee.com:darkhorse007/momento.git
darkhorse007
momento
momento
master

搜索帮助