()
| 133 | |
| 134 | // 自动检查走静默下载;手动检查仍由用户确认后再下载。 |
| 135 | const startDownloadUpdate = (): void => { |
| 136 | if (isDownloadingUpdate) return |
| 137 | isDownloadingUpdate = true |
| 138 | autoUpdater |
| 139 | .downloadUpdate() |
| 140 | .then(() => { |
| 141 | console.log('wait for post download operation') |
| 142 | }) |
| 143 | .catch((downloadError) => { |
| 144 | // 下载失败记录到日志,不显示给用户 |
| 145 | logger.error(`[Update] Download update failed: ${downloadError}`) |
| 146 | }) |
| 147 | .finally(() => { |
| 148 | isDownloadingUpdate = false |
| 149 | }) |
| 150 | } |
| 151 | |
| 152 | autoUpdater.on('update-available', (info) => { |
| 153 | // win.webContents.send('show-message', 'electron:发现新版本') |
no test coverage detected