新增单例应用功能

pull/96/head
lyswhut 2019-09-04 13:08:32 +08:00
parent 0586639e07
commit da764721d9
2 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,7 @@
### 新增
- 新增单例应用功能
### 优化
- 优化歌单列表动画

View File

@ -1,6 +1,20 @@
const { app, BrowserWindow, Menu } = require('electron')
const path = require('path')
// 单例应用程序
if (!app.requestSingleInstanceLock()) {
app.quit()
return
}
app.on('second-instance', (event, argv, cwd) => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
} else {
app.quit()
}
})
require('./events')
const progressBar = require('./events/progressBar')
const trafficLight = require('./events/trafficLight')
@ -90,4 +104,3 @@ app.on('activate', () => {
createWindow()
}
})