How to use the electron-updater.autoUpdater.once 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 MuzikaFoundation / muzika-platform / projects / studio-main / src / auto-update.service.ts View on Github external
if (isDev) {
      this.emit('available', false);
      Actions.app.setUpdatable('not-available');
      return;
    }

    MuzikaUpdater._isChecking = true;

    autoUpdater.removeAllListeners('update-available');
    autoUpdater.removeAllListeners('update-not-available');

    autoUpdater.once('update-available', () => {
      this.emit('available', true);
      Actions.app.setUpdatable('downloading');
    });
    autoUpdater.once('update-not-available', () => {
      MuzikaUpdater._isChecking = false;
      this.emit('available', false);
      Actions.app.setUpdatable('not-available');

    });
    autoUpdater.once('update-downloaded', () => {
      MuzikaUpdater._isChecking = false;
      MuzikaUpdater._updatable = true;
      this.emit('downloaded');
      Actions.app.setUpdatable('updatable');
    });

    autoUpdater.checkForUpdates();
    return this;
  }
}
github MuzikaFoundation / muzika-platform / projects / studio-main / src / auto-update.service.ts View on Github external
MuzikaUpdater._isChecking = true;

    autoUpdater.removeAllListeners('update-available');
    autoUpdater.removeAllListeners('update-not-available');

    autoUpdater.once('update-available', () => {
      this.emit('available', true);
      Actions.app.setUpdatable('downloading');
    });
    autoUpdater.once('update-not-available', () => {
      MuzikaUpdater._isChecking = false;
      this.emit('available', false);
      Actions.app.setUpdatable('not-available');

    });
    autoUpdater.once('update-downloaded', () => {
      MuzikaUpdater._isChecking = false;
      MuzikaUpdater._updatable = true;
      this.emit('downloaded');
      Actions.app.setUpdatable('updatable');
    });

    autoUpdater.checkForUpdates();
    return this;
  }
}
github Opentrons / opentrons / app-shell / src / update.js View on Github external
function checkUpdate(dispatch: Dispatch) {
  const onAvailable = (info: UpdateInfo) => done({ info, available: true })
  const onNotAvailable = (info: UpdateInfo) => done({ info, available: false })
  const onError = (error: Error) => done({ error: PlainObjectError(error) })

  updater.once('update-available', onAvailable)
  updater.once('update-not-available', onNotAvailable)
  updater.once('error', onError)

  updater.channel = getConfig('update.channel')
  updater.checkForUpdates()

  function done(payload: *) {
    updater.removeListener('update-available', onAvailable)
    updater.removeListener('update-not-available', onNotAvailable)
    updater.removeListener('error', onError)
    dispatch({ type: 'shell:CHECK_UPDATE_RESULT', payload })
  }
}
github Opentrons / opentrons / app-shell / src / update.js View on Github external
function checkUpdate(dispatch: Dispatch) {
  const onAvailable = (info: UpdateInfo) => done({ info, available: true })
  const onNotAvailable = (info: UpdateInfo) => done({ info, available: false })
  const onError = (error: Error) => done({ error: PlainObjectError(error) })

  updater.once('update-available', onAvailable)
  updater.once('update-not-available', onNotAvailable)
  updater.once('error', onError)

  updater.channel = getConfig('update.channel')
  updater.checkForUpdates()

  function done(payload: *) {
    updater.removeListener('update-available', onAvailable)
    updater.removeListener('update-not-available', onNotAvailable)
    updater.removeListener('error', onError)
    dispatch({ type: 'shell:CHECK_UPDATE_RESULT', payload })
  }
}
github Opentrons / opentrons / app-shell / src / update.js View on Github external
function downloadUpdate(dispatch: Dispatch) {
  const onDownloaded = () => done({})
  const onError = (error: Error) => done({ error: PlainObjectError(error) })

  updater.once('update-downloaded', onDownloaded)
  updater.once('error', onError)
  updater.downloadUpdate()

  function done(payload: *) {
    updater.removeListener('update-downloaded', onDownloaded)
    updater.removeListener('error', onError)
    dispatch({ type: 'shell:DOWNLOAD_UPDATE_RESULT', payload })
  }
}
github AugurProject / augur-app / src / main / check-for-updates.js View on Github external
module.exports = (notifyUpdateNotAvailable = false) => {
  if(isDev) return Promise.resolve()
  if(process.platform == "linux" && !process.env.APPIMAGE) return Promise.resolve()

  const p = new Promise((resolve) => {
    autoUpdater
      .once('update-not-available', resolve)
      .once('update-available', notifyUpdate(resolve))
  })

  autoUpdater
    .removeListener('update-not-available', notifyNoUpdate)

  if (notifyUpdateNotAvailable) autoUpdater
    .once('update-not-available', notifyNoUpdate)


  return autoUpdater.checkForUpdates().catch((e) => {
    log.error('There was an error updating app. This is expected if using deb package.')

    return Promise.resolve(p);
  });

  return p;
}
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');
          });
        });
github mskims / genie-music-player / src / main / features / autoUpdate.js View on Github external
export const checkForUpdates = (menuItem, focusedWindow, event) => {
  updater = menuItem
  updater.enabled = false
  autoUpdater.checkForUpdates()

  autoUpdater.once('update-not-available', () => {
    dialog.showMessageBox({
      title: 'No Updates',
      message: '최신버전이네요! 축하드립니다 🎉'
    })
    updater.enabled = true
    updater = null
  })
}
github Opentrons / opentrons / app-shell / src / update.js View on Github external
function checkUpdate(dispatch: Dispatch) {
  const onAvailable = (info: UpdateInfo) => done({ info, available: true })
  const onNotAvailable = (info: UpdateInfo) => done({ info, available: false })
  const onError = (error: Error) => done({ error: PlainObjectError(error) })

  updater.once('update-available', onAvailable)
  updater.once('update-not-available', onNotAvailable)
  updater.once('error', onError)

  updater.channel = getConfig('update.channel')
  updater.checkForUpdates()

  function done(payload: *) {
    updater.removeListener('update-available', onAvailable)
    updater.removeListener('update-not-available', onNotAvailable)
    updater.removeListener('error', onError)
    dispatch({ type: 'shell:CHECK_UPDATE_RESULT', payload })
  }
}