当前位置: 首页 > news >正文

医药企业建设网站需要什么河南专业网络推广公司

医药企业建设网站需要什么,河南专业网络推广公司,网站搭建中单页面,校园电商平台网站建设网很多electron-updater更新文章,这里只简单写一下演示代码; 为什么选择 electron-updater插件可以自动更新应用程序,同时支持多个平台;比官方要强; 官方的autoUpdater仅支持macOS 和 Windows 自动更新; 注意是自动,直接更新那种; 脚手架中是…

网很多electron-updater更新文章,这里只简单写一下演示代码;

为什么选择

electron-updater插件可以自动更新应用程序,同时支持多个平台;比官方要强;
官方的autoUpdater仅支持macOS 和 Windows 自动更新; 注意是自动,直接更新那种;

脚手架中是含有的electron-updater的
// 安装依赖如果你没有的话
npm i electron-updater
// 引入项目
const { autoUpdater } = require('electron-updater');
// 配置项
autoUpdater.forceDevUpdateConfig = true //开发环境下强制更新
autoUpdater.autoDownload = false; // 自动下载
autoUpdater.autoInstallOnAppQuit = true; // 应用退出后自动安装
封装一个简单方法
/****************  检查版本更新 start ***************** autoUpdater.checkForUpdates(); 检测是否最新版* autoUpdater.downloadUpdate(); 下载最新版
*/
// 检查是否更新
// 是否开启了检测
let isStartCheckForUpdates = false;
let customDialog: any = null;
function checkForUpdates(mainWindow, url?: string) {if (isStartCheckForUpdates) {return;}isStartCheckForUpdates = true;if (typeof url !== 'string') {url = 'https://xxx.cn/yyhDesktopUpdate/'}// 指定更新地址autoUpdater.setFeedURL(url);autoUpdater.autoDownload = false;autoUpdater.checkForUpdates();// 开始检查更新事件; 提示语: '正在检查更新';autoUpdater.on('checking-for-update', function () {});// 发现可更新版本; 提示语: 检测到新版本,准备下载autoUpdater.on('update-available', function () {if (customDialog) {customDialog.close();customDialog = null;}// 系统原生弹窗让用户选择是否更新customDialog = dialog.showMessageBox(mainWindow, {type: 'info',title: '检测到有新版本',message: '检测到新版本,是否立即更新?',buttons: ['确定', '取消'],cancelId: 1, // 指定“取消”按钮的索引}).then((result) => {customDialog = null;if (result.response === 0) {// 下载最新版autoUpdater.downloadUpdate();} else { // 用户点击了“取消”}isStartCheckForUpdates = false;}).catch(() => {customDialog = null;isStartCheckForUpdates = false;});});// 没有可更新版本事件; 提示语: '已经是最新版本';autoUpdater.on('update-not-available', function () {isStartCheckForUpdates = false;});// 更新发生错误时事件; 提示语: '软件更新异常,请重试';autoUpdater.on('error', function () {if (customDialog) {customDialog.close();customDialog = null;}// 提示用户更新失败customDialog = dialog.showMessageBox({type: 'info',title: '更新检查',message: '软件更新异常,请重试!',buttons: ['好的'],}).then(() => {customDialog = null;});});// 更新下载完毕后事件; 提示语: '下载完成,准备安装';autoUpdater.on('update-downloaded', function () {if (customDialog) {customDialog.close();customDialog = null;}// 下载后安装更新customDialog = dialog.showMessageBox({type: 'info',title: '更新完成',message: '更新已下载完成,是否立即安装应用?',buttons: ['立即安装'],}).then((result) => {customDialog = null;if (result.response === 0) {autoUpdater.quitAndInstall();}}).catch(() => {customDialog = null;});});// 更新下载进度事件; 提示语: '软件下载中,请耐心等待';autoUpdater.on('download-progress', function (progressObj) {/** progressObj {total: 1000000, // 总字节数,例如 1MBdelta: 1024, // 自上次事件以来下载的字节数,例如 1KBtransferred: 512000, // 已下载的总字节数,例如 512KBpercent: 0.5, // 下载进度的百分比,例如 50%bytesPerSecond: 2048 // 当前下载速度,例如 2KB/s}*/// 使用原生进度条if (progressObj.percent !== undefined) {mainWindow.setProgressBar(progressObj.percent);} else {mainWindow.setProgressBar(-1);}});
}
/****************  检查版本更新 end *****************/
调用
mainWindow.on('ready-to-show', () => {mainWindow.webContents.closeDevTools();mainWindow.show()// 调用检测方法checkForUpdates(mainWindow);})
软件更新win下载到哪个文件夹了
C:\Users\Administrator\AppData\Local
判断当前是那个系统_如果做系统差异化说不定用得到
/* 判断当前是那个系统* 如果 process.platform 返回的是 'darwin',则表示当前操作系统是 macOS。* 如果 process.platform 返回的是 'win32',则表示当前操作系统是 Windows。- 如果 process.arch 返回的是 'ia32',则表示当前系统是 32 位。- 如果 process.arch 返回的是 'x64',则表示当前系统是 64 位。* 如果 process.platform 返回的是 'linux',则表示当前操作系统是 Linux。
*/
http://www.hkea.cn/news/395102/

相关文章:

  • 新上线网站如何做搜索引擎站长素材网站
  • 做网站编辑深圳疫情防控最新消息
  • PHP网站开发项目式教程google下载手机版
  • 国外专门用于做网站图片的做网站要多少钱
  • 网站维护费用计入什么科目媒介星软文平台官网
  • 网站建设seo 视频做网站哪个平台好
  • 旅行社网站建设方案论文百度seo公司
  • 长沙网站建设与维护百度开户联系方式
  • 做pcr查基因序列的网站南京百度网站快速优化
  • 数据服务网站策划方案关键词快速优化排名软件
  • 响应式网站缺点学大教育培训机构电话
  • 江苏天德建设工程有限公司网站一个平台怎么推广
  • 石家庄做网络推广的网站推广平台收费标准
  • 贵阳天柱网站建设招聘域名注册平台有哪些
  • 网站建设电话营销百度问一问官网
  • 网站优化建设河南怎么关闭seo综合查询
  • 自贡做响应式网站开发公司google搜索引擎入口google
  • 东莞哪种网站推广好微信朋友圈推广文案
  • 现在学做网站赚钱吗东莞市优速网络科技有限公司
  • 宁津做网站公司宣传推广图片
  • 陕西的建设厅官方网站数据分析报告
  • 企业网站建设的定位互联网
  • 注册域名之后如何做网站优化清理大师
  • wordpress+在线播放推广seo网站
  • 丽水网站建设明恩玉杰网站开发框架
  • 如何设计网站中的上传功能搜索引擎技术基础
  • 余江区建设局网站百度搜索引擎优化的方法
  • 做网站用c 还是java万网域名注册教程
  • 青岛做网站那家好专业的网站优化公司排名
  • 网站如何做淘宝推广seo服务 收费