<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] > [安裝](https://segmentfault.com/a/1190000012904543) **注意:mac上不簽名也可以打包成功,但是涉及到自動更新等需要身份認證的功能則不能用,也不能發布到mac app store中。所以說經過代碼簽名的MAC包才是完整的包。我們這里一定是經過代碼簽名的完整包!切記!** ## 安裝 `npm install electron-updater --save ` ## 技巧 1. 升級訪問的url 參考格式 `https://raw.githubusercontent.com/idcpj/electron_demo/master/dist`, dist 有打包導出的目錄決定 2. 項目中`dist` 下要有 `last.yml`的文件,用于查詢是否更新 3. `dist`下要有`ele_demo-1.0.4.exe.blockmap` 格式的升級包,用于下載升級信息 ## demo 主進程 ``` const {ipcMain} = require('electron') const {autoUpdater} = require('electron-updater'); const uploadUrl=require('../../package.json').build.publish[0].url; // 檢測更新,在你想要檢查更新的時候執行,renderer事件觸發后的操作自行編寫 mainWindow = global.mainWindow // 通過main進程發送事件給renderer進程,提示更新信息 function sendUpdateMessage(text) { console.log(text); mainWindow.webContents.send('message', text) } exports.updateHandle=() =>{ let message = { error: '檢查更新出錯', checking: '正在檢查更新……', updateAva: '檢測到新版本,正在下載……', updateNotAva: '現在使用的就是最新版本,不用更新', }; autoUpdater.setFeedURL(uploadUrl); autoUpdater.on('error', function (error) { // console.log('===error==='); // console.log(error); sendUpdateMessage(message.error) }); autoUpdater.on('checking-for-update', function () { // console.log('===checking-for-update==='); sendUpdateMessage(message.checking) }); autoUpdater.on('update-available', function (info) { // console.log('===update-available==='); sendUpdateMessage(message.updateAva) }); autoUpdater.on('update-not-available', function (info) { // console.log('===update-not-available==='); sendUpdateMessage(message.updateNotAva) }); // 更新下載進度事件 autoUpdater.on('download-progress', function (progressObj) { // console.log('===download-progress==='); mainWindow.webContents.send('downloadProgress', progressObj) }) autoUpdater.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) { // console.log("==update-downloaded==="); ipcMain.on('isUpdateNow', (e, arg) => { // console.log("開始更新"); //some code here to handle event autoUpdater.quitAndInstall(); }); mainWindow.webContents.send('isUpdateNow') }); //接受更新指令 ipcMain.on("checkForUpdate",()=>{ // console.log("===checkForUpdate==="); //執行自動更新檢查 autoUpdater.checkForUpdates(); }) } ``` 渲染進程 ``` const {ipcRenderer} = require('electron'); function update(){ //發送主進程觸發更新指令 ipcRenderer.send("checkForUpdate"); ipcRenderer.on("message", (event, text) => { console.log("===message==="); document.querySelector('.show-txt').innerText=text; }); ipcRenderer.on("downloadProgress", (event, progressObj)=> { console.log("===downloadProgress==="); let downloadPercent = progressObj.percent || 0; document.querySelector('.show-percent').innerText= downloadPercent }); ipcRenderer.on("isUpdateNow", () => { console.log("===isUpdateNow==="); ipcRenderer.send("isUpdateNow"); }); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看