|
|
@ -121,7 +121,6 @@ app.disableHardwareAcceleration() // 禁用gpu
|
|
|
|
|
|
|
|
|
|
|
|
// 禁止双开
|
|
|
|
// 禁止双开
|
|
|
|
const isFirstInstance = app.requestSingleInstanceLock()
|
|
|
|
const isFirstInstance = app.requestSingleInstanceLock()
|
|
|
|
let isShutdown = false
|
|
|
|
|
|
|
|
if (!isFirstInstance) {
|
|
|
|
if (!isFirstInstance) {
|
|
|
|
console.log('is second instance')
|
|
|
|
console.log('is second instance')
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
@ -130,15 +129,12 @@ if (!isFirstInstance) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
app.on('before-quit', async (event) => {
|
|
|
|
app.on('before-quit', async (event) => {
|
|
|
|
console.log('before-quit')
|
|
|
|
console.log('before-quit')
|
|
|
|
if (!isShutdown) {
|
|
|
|
event.preventDefault()
|
|
|
|
event.preventDefault()
|
|
|
|
// if (tray) {
|
|
|
|
// if (tray) {
|
|
|
|
// tray.displayBalloon({ title: '正在关闭,请稍候...', content: '正在关闭中,请稍候。。。' })
|
|
|
|
// tray.displayBalloon({ title: '正在关闭,请稍候...', content: '正在关闭中,请稍候。。。' })
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
await bridge.devSidecar.api.shutdown()
|
|
|
|
await bridge.devSidecar.api.shutdown()
|
|
|
|
app.exit()
|
|
|
|
isShutdown = true
|
|
|
|
|
|
|
|
app.quit()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
app.on('second-instance', (event, commandLine, workingDirectory) => {
|
|
|
|
app.on('second-instance', (event, commandLine, workingDirectory) => {
|
|
|
|
console.log('new app started', commandLine)
|
|
|
|
console.log('new app started', commandLine)
|
|
|
@ -187,8 +183,8 @@ if (!isFirstInstance) {
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
updateUrl = 'https://dev-sidecar.docmirror.cn/update/'
|
|
|
|
// updateUrl = 'https://dev-sidecar.docmirror.cn/update/'
|
|
|
|
// updateUrl = 'http://localhost/dev-sidecar/'
|
|
|
|
updateUrl = 'http://localhost/dev-sidecar/'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 自动更新
|
|
|
|
// 自动更新
|
|
|
|
updateHandle(win, updateUrl)
|
|
|
|
updateHandle(win, updateUrl)
|
|
|
|