From 64a1b325fb49dd1acc865c3343673f304292ddca Mon Sep 17 00:00:00 2001 From: Oj Date: Thu, 28 Apr 2022 22:58:28 +0100 Subject: [PATCH] [Updater > Module] Minor source cleanup --- src/updater/moduleUpdater.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/updater/moduleUpdater.js b/src/updater/moduleUpdater.js index df24fdf..7b6e72e 100644 --- a/src/updater/moduleUpdater.js +++ b/src/updater/moduleUpdater.js @@ -16,7 +16,7 @@ let skipHost, skipModule, installed = {}, downloading, installing, basePath, manifestPath, downloadPath, - hostUpdater, + host, baseUrl, qs, last; @@ -56,7 +56,7 @@ exports.init = (endpoint, { releaseChannel, version }) => { } - hostUpdater = process.platform === 'linux' ? new (class HostLinux extends require('events').EventEmitter { + host = process.platform === 'linux' ? new (class HostLinux extends require('events').EventEmitter { setFeedURL(url) { this.url = url; } @@ -78,20 +78,20 @@ exports.init = (endpoint, { releaseChannel, version }) => { })() : autoUpdater; - hostUpdater.on('update-progress', progress => events.emit('downloading-module', { name: 'host', progress })); + host.on('update-progress', progress => events.emit('downloading-module', { name: 'host', progress })); - hostUpdater.on('update-manually', e => events.emit('manual', e)); + host.on('update-manually', e => events.emit('manual', e)); - hostUpdater.on('update-downloaded', hostUpdater.quitAndInstall); + host.on('update-downloaded', host.quitAndInstall); - hostUpdater.on('error', () => { + host.on('error', () => { log('Modules', 'Host error'); events.emit('checked', { failed: true }); }); const platform = process.platform === 'darwin' ? 'osx' : 'linux'; - hostUpdater.setFeedURL(`${endpoint}/updates/${releaseChannel}?platform=${platform}&version=${version}`); + host.setFeedURL(`${endpoint}/updates/${releaseChannel}?platform=${platform}&version=${version}`); baseUrl = `${endpoint}/modules/${releaseChannel}`; qs = { @@ -250,8 +250,8 @@ exports.checkForUpdates = async () => { let p = []; if (!skipHost) { - p.push(new Promise((res) => hostUpdater.once('update-not-available', res))); - hostUpdater.checkForUpdates(); + p.push(new Promise((res) => host.once('update-not-available', res))); + host.checkForUpdates(); } if (!skipModule) p.push(checkModules()); @@ -261,7 +261,7 @@ exports.checkForUpdates = async () => { }); }; -exports.quitAndInstallUpdates = () => hostUpdater.quitAndInstall(); +exports.quitAndInstallUpdates = () => host.quitAndInstall(); exports.isInstalled = (n, v) => installed[n] && !(v && installed[n].installedVersion !== v); exports.getInstalled = () => ({ ...installed });