Chudovische

Untitled

Jan 13th, 2021
970
1 day
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. autoUpdater.on('checking-for-update', () => {
  2.   //log.info('Checking for update');
  3. })
  4. autoUpdater.on('update-available', (info) => {
  5.   //log.info('Update available.');
  6.   autoUpdater.downloadUpdate();
  7. })
  8. autoUpdater.on('update-not-available', (info) => {
  9.   log.info('Update not available.');
  10.   const notif = new Notification({
  11.     title: 'Update not available',
  12.     body: 'You are using the latest version of Chisel CMS.'
  13.   });
  14.   notif.show();
  15.   notif.addListener('click', notif.close);
  16. })
  17. autoUpdater.on('error', (err) => {
  18.   log.warn('Error in auto-updater. ' + err);
  19. })
  20. autoUpdater.on('download-progress', (progressObj) => {
  21.   let logMessage = "Download speed: " + progressObj.bytesPerSecond;
  22.   logMessage = logMessage + ' - Downloaded ' + progressObj.percent + '%';
  23.   logMessage = logMessage + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
  24.   log.info(logMessage);
  25. })
  26. autoUpdater.on('update-downloaded', (info) => {
  27.   log.info('update downloaded');
  28.   const notif = new Notification({
  29.     title: 'Update was downloaded',
  30.     body: 'Restart Chisel CMS app to install update.',
  31.     actions: [{
  32.       type: 'button',
  33.       text: 'Restart'
  34.     }]
  35.   });
  36.   notif.show();
  37.   notif.addListener('action', autoUpdater.quitAndInstall)
  38. });
RAW Paste Data