How to use the electron-updater.autoUpdater.emit 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 RocketChat / Rocket.Chat.Electron / src / main / updates.js View on Github external
dialog.showMessageBox(mainWindow, {
			type: 'info',
			title: i18n.__('dialog.updateInstallLater.title'),
			message: i18n.__('dialog.updateInstallLater.message'),
			buttons: [i18n.__('dialog.updateInstallLater.ok')],
			defaultId: 0,
		});
		return;
	}

	mainWindow.removeAllListeners();
	app.removeAllListeners('window-all-closed');
	try {
		autoUpdater.quitAndInstall();
	} catch (e) {
		autoUpdater.emit('error', e);
	}
};
github appium / appium-desktop / app / main / mock-updater.js View on Github external
autoUpdater.emit('update-available', {
      version: 'v0.0.0',
      releaseDate: 'July 24th, 1985 asdfasdf asdfafds asdf  asdf  asfd asadfasd as dff',
      releaseNotes: `
          1. Feature 1
          2. Feature 2
          3. Feature 3
          4. Feature 4
          5. Feature 5
          6. Feature 6
          7. Feature 7
      `,
    });
  } else {
    await B.delay(5000);
    autoUpdater.emit('update-not-available');
  }
};
github MyCryptoHQ / MyCrypto / electron-app / main / updater.ts View on Github external
setTimeout(() => {
      if (i >= 5 && shouldMockUpdateError) {
        if (i === 5) {
          autoUpdater.emit(
            AutoUpdaterEvents.ERROR,
            new Error('Test error, nothing actually failed')
          );
        }
        return;
      }

      const total = 150000000;
      autoUpdater.emit(AutoUpdaterEvents.DOWNLOAD_PROGRESS, {
        bytesPerSecond: Math.round(Math.random() * 100000000),
        percent: i * 10,
        transferred: total / i,
        total
      });

      if (i === 10) {
        autoUpdater.emit(AutoUpdaterEvents.UPDATE_DOWNLOADED);
      }
    }, 500 * i);
  }
github MyCryptoHQ / MyCrypto / electron-app / main / updater.ts View on Github external
new Error('Test error, nothing actually failed')
          );
        }
        return;
      }

      const total = 150000000;
      autoUpdater.emit(AutoUpdaterEvents.DOWNLOAD_PROGRESS, {
        bytesPerSecond: Math.round(Math.random() * 100000000),
        percent: i * 10,
        transferred: total / i,
        total
      });

      if (i === 10) {
        autoUpdater.emit(AutoUpdaterEvents.UPDATE_DOWNLOADED);
      }
    }, 500 * i);
  }
github MyCryptoHQ / MyCrypto / electron-app / main / updater.ts View on Github external
function mockUpdateCheck() {
  autoUpdater.emit(AutoUpdaterEvents.CHECKING_FOR_UPDATE);

  setTimeout(() => {
    autoUpdater.emit(AutoUpdaterEvents.UPDATE_AVAILABLE, TEST_RELEASE);
  }, 3000);
}
github appium / appium-desktop / app / main / mock-updater.js View on Github external
autoUpdater.downloadUpdate = async () => {
  let progress = {
    bytesPerSecond: 100000,
    percent: 0,
    total: 10000000,
    transferred: 1000000,
  };

  while (progress.percent <= 100) {
    await B.delay(2000);
    autoUpdater.emit('download-progress', progress);
    if (fail && progress.percent > 50) {
      return autoUpdater.emit('error', new Error('An error occurred'));
    }
    progress.bytesPerSecond += (Math.random() * 50) - 24.999999999;
    progress.percent += 19.999991;
    progress.total = 499.999999999 * 1000000;
    progress.transferred += 100.0000000001 * 1000000;
  }
  updateDone = true;
  autoUpdater.emit('update-downloaded');
};
github MyCryptoHQ / MyCrypto / electron-app / main / updater.ts View on Github external
setTimeout(() => {
    autoUpdater.emit(AutoUpdaterEvents.UPDATE_AVAILABLE, TEST_RELEASE);
  }, 3000);
}
github MyCryptoHQ / MyCrypto / electron-app / main / updater.ts View on Github external
setTimeout(() => {
      if (i >= 5 && shouldMockUpdateError) {
        if (i === 5) {
          autoUpdater.emit(
            AutoUpdaterEvents.ERROR,
            new Error('Test error, nothing actually failed')
          );
        }
        return;
      }

      const total = 150000000;
      autoUpdater.emit(AutoUpdaterEvents.DOWNLOAD_PROGRESS, {
        bytesPerSecond: Math.round(Math.random() * 100000000),
        percent: i * 10,
        transferred: total / i,
        total
      });

      if (i === 10) {
github appium / appium-desktop / app / main / mock-updater.js View on Github external
autoUpdater.checkForUpdates = async () => {
  if (update && !updateDone) {
    await B.delay(Math.random() * 10000);
    autoUpdater.emit('update-available', {
      version: 'v0.0.0',
      releaseDate: 'July 24th, 1985 asdfasdf asdfafds asdf  asdf  asfd asadfasd as dff',
      releaseNotes: `
          1. Feature 1
          2. Feature 2
          3. Feature 3
          4. Feature 4
          5. Feature 5
          6. Feature 6
          7. Feature 7
      `,
    });
  } else {
    await B.delay(5000);
    autoUpdater.emit('update-not-available');
  }