Skip to content

Commit

Permalink
Merge pull request #58 from rishiqing/tim-beta
Browse files Browse the repository at this point in the history
fix: mac计划应用是,绑定事件
  • Loading branch information
TimZhang2090 authored Sep 1, 2021
2 parents 67aaecf + 6f2667c commit 5862c65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ function createWindow () {
// 创建浏览器窗口时,调用这个函数。
// 部分 API 在 ready 事件触发后才能使用。
app.on('ready', () => {
console.log('ready')
createWindow()
registerShortcut() // 注册快捷键
autoUpdata() // 自动更新
autoUpdate() // 自动更新
setContextmenu(win.webContents) // 设置右击菜单
isDomReady(win.webContents) // 刷新后 dom 加载完成执行的事件
setTheLock() // 获取设备锁,当打开第二个客户端时
Expand All @@ -81,10 +82,14 @@ app.on('window-all-closed', () => {
})

app.on('activate', () => {
console.log('activate')
// 在macOS上,当单击dock图标并且没有其他窗口打开时,
// 通常在应用程序中重新创建一个窗口。
if (win === null) {
createWindow()
registerShortcut() // 注册快捷键
setContextmenu(win.webContents) // 设置右击菜单
isDomReady(win.webContents) // 刷新后 dom 加载完成执行的事件
}
})

Expand Down Expand Up @@ -263,7 +268,7 @@ function isDomReady(contents) {
}

/** 显示更新弹框 */
function autoUpdata() {
function autoUpdate() {
autoUpdater.checkForUpdates()
// autoUpdater.on('update-downloaded', function (info) {
// const notify = new Notification({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tingkelai-electron",
"version": "1.0.11",
"version": "1.0.12",
"description": "听客来PC客户端",
"main": "main.js",
"author": "南京听客来信息技术有限公司",
Expand Down

0 comments on commit 5862c65

Please sign in to comment.