当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript autoUpdater.quitAndInstall方法代码示例

本文整理汇总了TypeScript中electron.autoUpdater.quitAndInstall方法的典型用法代码示例。如果您正苦于以下问题:TypeScript autoUpdater.quitAndInstall方法的具体用法?TypeScript autoUpdater.quitAndInstall怎么用?TypeScript autoUpdater.quitAndInstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.autoUpdater的用法示例。


在下文中一共展示了autoUpdater.quitAndInstall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 ipcMain.on("restart", () => {
     autoUpdater.quitAndInstall();
 });
开发者ID:zlepper,项目名称:go-modpack-packer,代码行数:3,代码来源:IpcHandlers.ts

示例2: checkDownloadAndInstall

async function checkDownloadAndInstall(
  getMainWindow: () => BrowserWindow,
  messages: MessagesType,
  logger: LoggerType
) {
  if (isChecking) {
    return;
  }

  logger.info('checkDownloadAndInstall: checking for update...');
  try {
    isChecking = true;

    const result = await checkForUpdates(logger);
    if (!result) {
      return;
    }

    const { fileName: newFileName, version: newVersion } = result;
    if (fileName !== newFileName || !version || gt(newVersion, version)) {
      deleteCache(updateFilePath, logger);
      fileName = newFileName;
      version = newVersion;
      updateFilePath = await downloadUpdate(fileName, logger);
    }

    const publicKey = hexToBinary(getFromConfig('updatesPublicKey'));
    const verified = verifySignature(updateFilePath, version, publicKey);
    if (!verified) {
      // Note: We don't delete the cache here, because we don't want to continually
      //   re-download the broken release. We will download it only once per launch.
      throw new Error(
        `checkDownloadAndInstall: Downloaded update did not pass signature verification (version: '${version}'; fileName: '${fileName}')`
      );
    }

    try {
      await handToAutoUpdate(updateFilePath, logger);
    } catch (error) {
      const readOnly = 'Cannot update while running on a read-only volume';
      const message: string = error.message || '';
      if (message.includes(readOnly)) {
        logger.info('checkDownloadAndInstall: showing read-only dialog...');
        await showReadOnlyDialog(getMainWindow(), messages);
      } else {
        logger.info(
          'checkDownloadAndInstall: showing general update failure dialog...'
        );
        await showCannotUpdateDialog(getMainWindow(), messages);
      }

      throw error;
    }

    // At this point, closing the app will cause the update to be installed automatically
    //   because Squirrel has cached the update file and will do the right thing.

    logger.info('checkDownloadAndInstall: showing update dialog...');
    const shouldUpdate = await showUpdateDialog(getMainWindow(), messages);
    if (!shouldUpdate) {
      return;
    }

    logger.info('checkDownloadAndInstall: calling quitAndInstall...');
    markShouldQuit();
    autoUpdater.quitAndInstall();
  } catch (error) {
    logger.error('checkDownloadAndInstall: error', getPrintableError(error));
  } finally {
    isChecking = false;
  }
}
开发者ID:WhisperSystems,项目名称:Signal-Desktop,代码行数:72,代码来源:macos.ts


注:本文中的electron.autoUpdater.quitAndInstall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。