let mainWindow
let tray
const createWindow = async () => {
const urlLocation = `file://${path.join(__dirname, './renderer/index/index.html')}`
mainWindow = new AppWindow({}, urlLocation)
mainWindow.removeMenu() // 隐藏菜单栏
mainWindow.webContents.on('did-finish-load', () => {
mainWindow.send('platform', { platform: os.platform() })
})
ipcMain.on('close-add-window', () => {
addWindow.close()
})
ipcMain.on('refresh', async (event, data) => {
allHardInfo = await getAllHardInfo()
mainWindow.send('changeAllInfo', allHardInfo)
})
mainWindow.on('close', (e, a,v) => {
e.preventDefault()
mainWindow.hide()
})
// 设置托盘
tray = new Tray(path.join(__dirname, './tray16.png'));
tray.on('click', ()=>{
mainWindow.show()
mainWindow.moveTop()
})
}
app.on('ready', createWindow)
app.on('before-quit', (e) => {
app.exit()
console.log('quit')
})
app.on('activate', () => {
mainWindow.show()
});
← 编写一个babel插件 Fiber →