How to use the electron-updater.autoUpdater.addListener 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 Superjo149 / auryo / src / main / features / core / appUpdater.ts View on Github external
this.updateLinux();
    } else {
      autoUpdater.addListener('update-available', () => {
        this.hasUpdate = true;
        this.logger.info('New update available');
      });

      autoUpdater.addListener('update-downloaded', (info) => {
        this.notify(info.version);

        this.listenUpdate();
      });
      autoUpdater.addListener('error', (error) => {
        this.logger.error(error);
      });
      autoUpdater.addListener('checking-for-update', () => {
        this.logger.info('Checking for update');
      });
      autoUpdater.addListener('update-not-available', () => {
        this.logger.info('No update found');

        setTimeout(() => {
          autoUpdater.checkForUpdates();
        }, 300000);
      });

      // if (this.platform === 'darwin') {
      //     autoUpdater.setFeedURL(`https://${CONFIG.UPDATE_SERVER_HOST}/update/darwin?version=${this.currentVersion}`);
      // }

      autoUpdater.checkForUpdates();
    }
github quanglam2807 / webcatalog / src / main / libs / checkForUpdate.js View on Github external
setTimeout(() => {
      // Auto updater
      if (shouldUseSquirrel(isSSB)) {
        /* eslint-disable global-require */
        const autoUpdater = require('electron-updater').autoUpdater;
        /* eslint-enable global-require */
        autoUpdater.addListener('update-downloaded', (event, releaseNotes, releaseName) => {
          dialog.showMessageBox({
            type: 'info',
            buttons: ['Yes', 'Cancel'],
            defaultId: 1,
            title: 'A new update is ready to install',
            message: `Version ${releaseName} is downloaded and will be automatically installed. Do you want to quit the app to install it now?`,
          }, (response) => {
            if (response === 0) {
              autoUpdater.quitAndInstall();
            }
          });
        });

        autoUpdater.addListener('error', err => log(`Update error: ${err.message}`));
        autoUpdater.on('checking-for-update', () => log('Checking for update'));
        autoUpdater.on('update-available', () => log('Update available'));
github quanglam2807 / webcatalog / src / main / libs / checkForUpdate.js View on Github external
/* eslint-enable global-require */
        autoUpdater.addListener('update-downloaded', (event, releaseNotes, releaseName) => {
          dialog.showMessageBox({
            type: 'info',
            buttons: ['Yes', 'Cancel'],
            defaultId: 1,
            title: 'A new update is ready to install',
            message: `Version ${releaseName} is downloaded and will be automatically installed. Do you want to quit the app to install it now?`,
          }, (response) => {
            if (response === 0) {
              autoUpdater.quitAndInstall();
            }
          });
        });

        autoUpdater.addListener('error', err => log(`Update error: ${err.message}`));
        autoUpdater.on('checking-for-update', () => log('Checking for update'));
        autoUpdater.on('update-available', () => log('Update available'));
        autoUpdater.on('update-not-available', () => log('No update available'));

        autoUpdater.checkForUpdates();
      } else {
        https.get({
          host: 'api.github.com',
          path: '/repos/webcatalog/webcatalog/releases/latest',
          method: 'GET',
          headers: { 'user-agent': `WebCatalog/${app.getVersion()}` },
        }, (res) => {
          if (res.statusCode >= 200 && res.statusCode <= 299) {
            let body = '';
            res.on('data', (chunk) => {
              body += chunk;
github signalapp / Signal-Desktop / app / auto_update.js View on Github external
function initialize(getMainWindow, messages) {
  if (!messages) {
    throw new Error('auto-update initialize needs localized messages');
  }

  if (autoUpdateDisabled()) {
    return;
  }

  autoUpdater.addListener('update-downloaded', () => {
    showUpdateDialog(getMainWindow(), messages);
  });
  autoUpdater.addListener('error', onError);

  checkForUpdates();

  setInterval(checkForUpdates, autoUpdaterInterval);
}
github elyukai / optolith-client / src / main.ts View on Github external
ipcMain.addListener('loading-done', () => {
      if (process.platform !== 'linux') {
        autoUpdater.checkForUpdates();

        autoUpdater.addListener('update-available', (info: UpdateInfo) => {
          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 => {
github LeagueDevelopers / lol-skins-viewer / app / AutoUpdater.js View on Github external
autoUpdater.checkForUpdates();
  });

  autoUpdater.addListener('update-available', () => {
    debug('New update available');
    dispatchToRenderer(newVersion());
  });
  autoUpdater.addListener('update-not-available', () => {
    debug('No new updates');
  });
  autoUpdater.addListener('update-downloaded', () => {
    debug('Quitting to install new update');
    autoUpdater.quitAndInstall();
    return true;
  });
  autoUpdater.addListener('download-progress', progress => {
    debug('Update Progress', progress);
    dispatchToRenderer(updateProgress(Math.floor(progress.percent) || 0));
  });
  autoUpdater.addListener('error', error => {
    debug(error);
  });
}
github elyukai / optolith-client / src / main.ts View on Github external
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 LeagueDevelopers / lol-skins-viewer / app / AutoUpdater.js View on Github external
debug('New update available');
    dispatchToRenderer(newVersion());
  });
  autoUpdater.addListener('update-not-available', () => {
    debug('No new updates');
  });
  autoUpdater.addListener('update-downloaded', () => {
    debug('Quitting to install new update');
    autoUpdater.quitAndInstall();
    return true;
  });
  autoUpdater.addListener('download-progress', progress => {
    debug('Update Progress', progress);
    dispatchToRenderer(updateProgress(Math.floor(progress.percent) || 0));
  });
  autoUpdater.addListener('error', error => {
    debug(error);
  });
}
github LeagueDevelopers / lol-skins-viewer / app / AutoUpdater.js View on Github external
if (platform === 'linux') {
    return;
  }

  (browserWindow || global.mainWindow).webContents.once('did-finish-load', () => {
    autoUpdater.checkForUpdates();
  });

  autoUpdater.addListener('update-available', () => {
    debug('New update available');
    dispatchToRenderer(newVersion());
  });
  autoUpdater.addListener('update-not-available', () => {
    debug('No new updates');
  });
  autoUpdater.addListener('update-downloaded', () => {
    debug('Quitting to install new update');
    autoUpdater.quitAndInstall();
    return true;
  });
  autoUpdater.addListener('download-progress', progress => {
    debug('Update Progress', progress);
    dispatchToRenderer(updateProgress(Math.floor(progress.percent) || 0));
  });
  autoUpdater.addListener('error', error => {
    debug(error);
  });
}
github LeagueDevelopers / lol-skins-viewer / app / AutoUpdater.js View on Github external
}

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

  (browserWindow || global.mainWindow).webContents.once('did-finish-load', () => {
    autoUpdater.checkForUpdates();
  });

  autoUpdater.addListener('update-available', () => {
    debug('New update available');
    dispatchToRenderer(newVersion());
  });
  autoUpdater.addListener('update-not-available', () => {
    debug('No new updates');
  });
  autoUpdater.addListener('update-downloaded', () => {
    debug('Quitting to install new update');
    autoUpdater.quitAndInstall();
    return true;
  });
  autoUpdater.addListener('download-progress', progress => {
    debug('Update Progress', progress);
    dispatchToRenderer(updateProgress(Math.floor(progress.percent) || 0));
  });
  autoUpdater.addListener('error', error => {
    debug(error);
  });
}