autoUpdater.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // 'use strict';
  2. // const updater = require("electron-updater");
  3. // const autoUpdater = updater.autoUpdater;
  4. // const config = require('./config');
  5. // const path = require('path');
  6. // const {app} = require('electron');
  7. // exports.setup = function () {
  8. // const pkgInfo = require(path.join(app.getAppPath(), 'package.json'));
  9. // ELog.info('[autoUpdater] [setup] current version: ', pkgInfo.version);
  10. // const updateConfig = config.get('autoUpdate');
  11. // autoUpdater.setFeedURL(updateConfig.options);
  12. // autoUpdater.on('checking-for-update', () => {
  13. // sendStatusToWindow('Checking for update...');
  14. // })
  15. // autoUpdater.on('update-available', (info) => {
  16. // sendStatusToWindow('Update available.');
  17. // })
  18. // autoUpdater.on('update-not-available', (info) => {
  19. // sendStatusToWindow('Update not available.');
  20. // })
  21. // autoUpdater.on('error', (err) => {
  22. // sendStatusToWindow('Error in auto-updater. ' + err);
  23. // })
  24. // autoUpdater.on('download-progress', (progressObj) => {
  25. // let log_message = "Download speed: " + progressObj.bytesPerSecond;
  26. // log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
  27. // log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
  28. // sendStatusToWindow(log_message);
  29. // })
  30. // autoUpdater.on('update-downloaded', (info) => {
  31. // sendStatusToWindow('Update downloaded');
  32. // // quit and update
  33. // autoUpdater.quitAndInstall();
  34. // });
  35. // };
  36. // exports.checkUpdate = function () {
  37. // autoUpdater.checkForUpdatesAndNotify();
  38. // }
  39. // function sendStatusToWindow(text) {
  40. // ELog.info(text);
  41. // MAIN_WINDOW.webContents.send('message', text);
  42. // }
  43. // exports = module.exports;