How to use the electron-updater.autoUpdater.removeAllListeners 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 (MuzikaUpdater._updatable) {
      this.emit('error', new Error('already downloaded'));
      return;
    }

    // if in development mode, don't check update and just emit not update available event.
    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');
github MuzikaFoundation / muzika-platform / projects / studio-main / src / auto-update.service.ts View on Github external
if (MuzikaUpdater._updatable) {
      this.emit('error', new Error('already downloaded'));
      return;
    }

    // if in development mode, don't check update and just emit not update available event.
    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');
github meetalva / alva / src / electron / auto-updater.ts View on Github external
export function stopUpdater(): void {
	autoUpdater.removeAllListeners();
}
github tutao / tutanota / src / desktop / ElectronUpdater.js View on Github external
}).on('error', e => {
			const ee: any = e
			this._stopPolling()
			this._errorCount += 1
			if (this._errorCount >= 5) {
				this._logger.error(`Auto Update Error ${this._errorCount}, shutting down updater:\n${ee.message}`)
				autoUpdater.removeAllListeners('update-available')
				autoUpdater.removeAllListeners('update-downloaded')
				autoUpdater.removeAllListeners('checking-for-update')
				autoUpdater.removeAllListeners('error')
				throw new UpdateError(`Update failed multiple times. Last error:\n${ee.message}`)
			} else {
				this._logger.error(`Auto Update Error ${this._errorCount}, continuing polling:\n${ee.message}`)
				this._notifyUpdateError()
				setTimeout(() => this._startPolling(), this._fallbackPollInterval)
			}
		})
	}
github notable / notable / src / main / app.ts View on Github external
__updaterCheck = async ( notifications: Event | boolean = false ) => {

    updater.removeAllListeners ();

    if ( notifications === true ) {

      updater.on ( 'update-available', () => Notification.show ( 'A new update is available', 'Downloading it right now...' ) );
      updater.on ( 'update-not-available', () => Notification.show ( 'No update is available', 'You\'re already using the latest version' ) );
      updater.on ( 'error', err => {
        Notification.show ( 'An error occurred', err.message );
        Notification.show ( 'Update manually', 'Download the new version manually to update the app' );
        shell.openExternal ( pkg['download'].url );
      });

    }

    updater.checkForUpdatesAndNotify ();

  }
github zulip / zulip-desktop / app / main / autoupdater.ts View on Github external
eventsListenerRemove.forEach(event => {
				autoUpdater.removeAllListeners(event);
			});
		}
github tutao / tutanota / src / desktop / ElectronUpdater.js View on Github external
}).on('error', e => {
			const ee: any = e
			this._stopPolling()
			this._errorCount += 1
			if (this._errorCount >= 5) {
				this._logger.error(`Auto Update Error ${this._errorCount}, shutting down updater:\n${ee.message}`)
				autoUpdater.removeAllListeners('update-available')
				autoUpdater.removeAllListeners('update-downloaded')
				autoUpdater.removeAllListeners('checking-for-update')
				autoUpdater.removeAllListeners('error')
				throw new UpdateError(`Update failed multiple times. Last error:\n${ee.message}`)
			} else {
				this._logger.error(`Auto Update Error ${this._errorCount}, continuing polling:\n${ee.message}`)
				this._notifyUpdateError()
				setTimeout(() => this._startPolling(), this._fallbackPollInterval)
			}
		})
	}
github elyukai / optolith-client / src / main.ts View on Github external
autoUpdater.addListener('update-available', (info: UpdateInfo) => {
          mainWindow!.webContents.send('update-available', info);
          autoUpdater.removeAllListeners('update-not-available');
        });
github anther / smashladder-desktop / app / main.dev.js View on Github external
_.forEach(listeners, (listenerFunction, listenerName) => {
		autoUpdater.removeAllListeners(listenerName);
		autoUpdater.on(listenerName, listenerFunction);
	});
	event.sender.send('autoUpdate-initialized');
github tutao / tutanota / src / desktop / ElectronUpdater.js View on Github external
}).on('error', e => {
			const ee: any = e
			this._stopPolling()
			this._errorCount += 1
			if (this._errorCount >= 5) {
				this._logger.error(`Auto Update Error ${this._errorCount}, shutting down updater:\n${ee.message}`)
				autoUpdater.removeAllListeners('update-available')
				autoUpdater.removeAllListeners('update-downloaded')
				autoUpdater.removeAllListeners('checking-for-update')
				autoUpdater.removeAllListeners('error')
				throw new UpdateError(`Update failed multiple times. Last error:\n${ee.message}`)
			} else {
				this._logger.error(`Auto Update Error ${this._errorCount}, continuing polling:\n${ee.message}`)
				this._notifyUpdateError()
				setTimeout(() => this._startPolling(), this._fallbackPollInterval)
			}
		})
	}