fix: 修复升级后没有完全退出的问题
							parent
							
								
									f12d9d5bc6
								
							
						
					
					
						commit
						04cd99b931
					
				|  | @ -1,6 +1,6 @@ | |||
| { | ||||
|   "name": "@docmirror/dev-sidecar-gui", | ||||
|   "version": "1.1.0", | ||||
|   "version": "1.0.2", | ||||
|   "private": false, | ||||
|   "license": "MPL-2.0", | ||||
|   "scripts": { | ||||
|  |  | |||
|  | @ -121,7 +121,6 @@ app.disableHardwareAcceleration() // 禁用gpu | |||
| 
 | ||||
| // 禁止双开
 | ||||
| const isFirstInstance = app.requestSingleInstanceLock() | ||||
| let isShutdown = false | ||||
| if (!isFirstInstance) { | ||||
|   console.log('is second instance') | ||||
|   setTimeout(() => { | ||||
|  | @ -130,15 +129,12 @@ if (!isFirstInstance) { | |||
| } else { | ||||
|   app.on('before-quit', async (event) => { | ||||
|     console.log('before-quit') | ||||
|     if (!isShutdown) { | ||||
|       event.preventDefault() | ||||
|       // if (tray) {
 | ||||
|       //   tray.displayBalloon({ title: '正在关闭,请稍候...', content: '正在关闭中,请稍候。。。' })
 | ||||
|       // }
 | ||||
|       await bridge.devSidecar.api.shutdown() | ||||
|       isShutdown = true | ||||
|       app.quit() | ||||
|     } | ||||
|     event.preventDefault() | ||||
|     // if (tray) {
 | ||||
|     //   tray.displayBalloon({ title: '正在关闭,请稍候...', content: '正在关闭中,请稍候。。。' })
 | ||||
|     // }
 | ||||
|     await bridge.devSidecar.api.shutdown() | ||||
|     app.exit() | ||||
|   }) | ||||
|   app.on('second-instance', (event, commandLine, workingDirectory) => { | ||||
|     console.log('new app started', commandLine) | ||||
|  | @ -187,8 +183,8 @@ if (!isFirstInstance) { | |||
|           return true | ||||
|         } | ||||
|       }) | ||||
|       updateUrl = 'https://dev-sidecar.docmirror.cn/update/' | ||||
|       // updateUrl = 'http://localhost/dev-sidecar/'
 | ||||
|       // updateUrl = 'https://dev-sidecar.docmirror.cn/update/'
 | ||||
|       updateUrl = 'http://localhost/dev-sidecar/' | ||||
|     } | ||||
|     // 自动更新
 | ||||
|     updateHandle(win, updateUrl) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 xiaojunnuo
						xiaojunnuo