这里主要解决让用户是否选择更新,更加友好。javascript
autoUpdater.autoDownload = false //这句代码很重要 autoUpdater.on('error', function(error) { sendUpdateMessage(message.error) }); autoUpdater.on('checking-for-update', function() { sendUpdateMessage(message.checking) }); autoUpdater.on('update-available', function(info) { const options = { type: 'info', title: '更新提示', message: "有新版本须要更新", buttons: ['如今更新', '稍后'] } dialog.showMessageBox(options, function(index) { if (index == 0) { sendUpdateMessage("开始更新") autoUpdater.downloadUpdate();//还有这句 } }) });
自带的autoUpdater和electron-update更新java
参考资料:https://segmentfault.com/a/1190000010271226segmentfault