How to use the electron-updater.autoUpdater.signals function in electron-updater

To help you get started, we’ve selected a few electron-updater examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mattermost / desktop / src / main / autoUpdater.js View on Github external
}).on('click-install', () => {
        updaterModal.webContents.send('start-download');
        autoUpdater.signals.progress((data) => { // eslint-disable-line max-nested-callbacks
          updaterModal.send('progress', Math.floor(data.percent));
          console.log('progress:', data);
        });
        cancellationToken = new CancellationToken();
        downloadAndInstall(cancellationToken);
      }).on('click-download', () => {
        shell.openExternal('https://about.mattermost.com/download/#mattermostApps');
github skellock / typescript-with-electron-react-kit / src / lib / updater / updater.ts View on Github external
log.info("checking for update")
  })

  autoUpdater.on("update-available", (info: string) => {
    log.info("update available")
  })

  autoUpdater.on("update-not-available", (info: string) => {
    log.info("update not available")
  })

  autoUpdater.on("error", (err: Error) => {
    log.error("error updating", err.message)
  })

  autoUpdater.signals.progress(info => {
    log.info(`${info.percent}%`)
  })

  // fires when an update has been downloaded
  autoUpdater.signals.updateDownloaded(info => {
    log.info("update downloaded")
    autoUpdater.quitAndInstall()
  })
}
github skellock / typescript-with-electron-react-kit / src / lib / updater / updater.ts View on Github external
})

  autoUpdater.on("update-not-available", (info: string) => {
    log.info("update not available")
  })

  autoUpdater.on("error", (err: Error) => {
    log.error("error updating", err.message)
  })

  autoUpdater.signals.progress(info => {
    log.info(`${info.percent}%`)
  })

  // fires when an update has been downloaded
  autoUpdater.signals.updateDownloaded(info => {
    log.info("update downloaded")
    autoUpdater.quitAndInstall()
  })
}
github elyukai / optolith-client / src / main.ts View on Github external
ipcMain.addListener('check-for-updates', () => {
          autoUpdater.checkForUpdates();
          autoUpdater.once('update-not-available', () => {
            mainWindow!.webContents.send('update-not-available');
          });
        });

        autoUpdater.signals.progress(progressObj => {
          mainWindow!.webContents.send('download-progress', progressObj);
        });

        autoUpdater.addListener('error', (err: Error) => {
          mainWindow!.webContents.send('auto-updater-error', err);
        });

        autoUpdater.signals.updateDownloaded(() => {
          autoUpdater.quitAndInstall();
        });
      }
    });
  });
github elyukai / optolith-client / src / main.ts View on Github external
mainWindow!.webContents.send('update-available', info);
          autoUpdater.removeAllListeners('update-not-available');
        });

        ipcMain.addListener('download-update', () => {
          autoUpdater.downloadUpdate();
        });

        ipcMain.addListener('check-for-updates', () => {
          autoUpdater.checkForUpdates();
          autoUpdater.once('update-not-available', () => {
            mainWindow!.webContents.send('update-not-available');
          });
        });

        autoUpdater.signals.progress(progressObj => {
          mainWindow!.webContents.send('download-progress', progressObj);
        });

        autoUpdater.addListener('error', (err: Error) => {
          mainWindow!.webContents.send('auto-updater-error', err);
        });

        autoUpdater.signals.updateDownloaded(() => {
          autoUpdater.quitAndInstall();
        });
      }
    });
  });
github vitrine-app / vitrine / sources / server / Server.ts View on Github external
public async loaderReady() {
    if (!isProduction()) {
      this.windowsHandler.sendToLoader('no-update-found');
      return;
    }
    logger.info('Server', 'Checking for updates.');
    autoUpdater.allowPrerelease = true;
    autoUpdater.signals.progress((progress: ProgressInfo) => {
      this.windowsHandler.sendToLoader('update-progress', Math.round(progress.percent));
    });
    autoUpdater.signals.updateDownloaded(() => {
      autoUpdater.quitAndInstall(true, true);
    });
    try {
      const lastUpdate: UpdateCheckResult = await autoUpdater.checkForUpdates();
      if (compareVersion(lastUpdate.updateInfo.version, autoUpdater.currentVersion.version) === 1) {
        logger.info('Server', `Update ${lastUpdate.updateInfo.version} found.`);
        this.windowsHandler.sendToLoader('update-found', lastUpdate.updateInfo.version);
      } else {
        logger.info('Server', 'No updates found.');
        this.windowsHandler.sendToLoader('no-update-found');
      }
    } catch (error) {
      logger.info('Server', 'Internet is offline, aborting updates checking.');
github bleenco / bterm / src / app-updater.ts View on Github external
constructor() {

    const platform = os.platform();
    if (platform === 'linux' || isDev) {
      return;
    }

    const log = require('electron-log')
    log.transports.file.level = 'info';
    autoUpdater.logger = log;

    autoUpdater.signals.updateDownloaded(it => {
      notify('A new update is ready to install', `Version ${it.version} is downloaded and will be automatically installed on Quit`)
    });

    autoUpdater.checkForUpdates();
  }
}
github vitrine-app / vitrine / sources / server / Server.ts View on Github external
public async loaderReady() {
    if (!isProduction()) {
      this.windowsHandler.sendToLoader('no-update-found');
      return;
    }
    logger.info('Server', 'Checking for updates.');
    autoUpdater.allowPrerelease = true;
    autoUpdater.signals.progress((progress: ProgressInfo) => {
      this.windowsHandler.sendToLoader('update-progress', Math.round(progress.percent));
    });
    autoUpdater.signals.updateDownloaded(() => {
      autoUpdater.quitAndInstall(true, true);
    });
    try {
      const lastUpdate: UpdateCheckResult = await autoUpdater.checkForUpdates();
      if (compareVersion(lastUpdate.updateInfo.version, autoUpdater.currentVersion.version) === 1) {
        logger.info('Server', `Update ${lastUpdate.updateInfo.version} found.`);
        this.windowsHandler.sendToLoader('update-found', lastUpdate.updateInfo.version);
      } else {
        logger.info('Server', 'No updates found.');
        this.windowsHandler.sendToLoader('no-update-found');
      }
    } catch (error) {
      logger.info('Server', 'Internet is offline, aborting updates checking.');
      this.windowsHandler.sendToLoader('no-update-found');
    }
  }
github textlint / textlint-app / src / node / electron / AppUpdater.js View on Github external
constructor() {
        if (isDev) {
            return;
        }

        const platform = os.platform();
        if (platform === "linux") {
            return;
        }

        autoUpdater.logger = console;
        autoUpdater.signals.updateDownloaded(it => {
            notify("A new update is ready to install", `Version ${it.version} is downloaded and will be automatically installed on Quit`);
        });
        autoUpdater.checkForUpdates();
    }
}
github develar / onshape-desktop-shell / src / AppUpdater.ts View on Github external
constructor() {
    if (isDev()) {
      return
    }

    const platform = os.platform()
    if (platform === "linux") {
      return
    }

    const log = require("electron-log")
    log.transports.file.level = "info"
    autoUpdater.logger = log

    autoUpdater.signals.updateDownloaded(versionInfo => {
      const dialogOptions = {
        type: "question",
        defaultId: 0,
        message: `The update is ready to install, Version ${versionInfo.version} has been downloaded and will be automatically installed when you click OK`
      }
      let focusedWindow = BrowserWindow.getFocusedWindow()

      BrowserWindow.getAllWindows()
      dialog.showMessageBox(focusedWindow, dialogOptions, function () {
        setImmediate(() => {
          app.removeAllListeners("window-all-closed")
          if (focusedWindow != null) {
            focusedWindow.close()
          }
          autoUpdater.quitAndInstall(false)
        })