he wei
2022-11-17 cd327dcbaca3476df44b064e56b950dc054cbb87
src/background.js
@@ -32,6 +32,11 @@
 * 
 * 
 */
Object.defineProperty(app, 'isPackaged', {
  get() {
    return true;
  }
});
// 单例锁
const gotTheLock = app.requestSingleInstanceLock()
@@ -100,9 +105,19 @@
  }
  if (cb && 'function' == typeof cb) {
    win.once('ready-to-show', () => {
      log.info('900')
      cb(win.webContents);
    })
  }
  // 自动检测更新 软件的第一个实例打开后 为了不影响加载速度 在指定时间后做一次自检
  win.once('ready-to-show', () => {
    log.info('ready event');
    // TODO
    setTimeout(() => {
      update(win.webContents, true);
    }, 1000 * 10);
  });
  win.webContents.session.on('will-download', (e, item) => {
    // const filePath = path.join(saveUrl, item.getFilename());
@@ -207,6 +222,10 @@
  update(event.sender);
});
ipcMain.on('download-update', () => {
  autoUpdater.downloadUpdate();
});
ipcMain.on('quitAndInstall', () => {
  autoUpdater.quitAndInstall();
});