From 9f7920d287f6e8e4410e1f24dbeb4cf4758400f0 Mon Sep 17 00:00:00 2001 From: Oj Date: Wed, 16 Feb 2022 10:34:23 +0000 Subject: [PATCH] [Splash > Backend] Clean up source a bit --- src/splash/index.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/splash/index.js b/src/splash/index.js index caa1e9e..519ab04 100644 --- a/src/splash/index.js +++ b/src/splash/index.js @@ -164,7 +164,7 @@ class UIProgress { // Generic class to track updating and sent states to splash } } - sendState() { + send() { if (this.progress.size > 0 && this.progress.size > this.done.size) { splashState = { current: this.done.size + 1, @@ -201,7 +201,7 @@ const updateUntilCurrent = async () => { if (download != null) downloads.record(download.package_sha256, state, percent); - if (!downloads.sendState()) installs.sendState(); + if (!downloads.send()) installs.send(); if (install == null) return; @@ -293,13 +293,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only) if (failed > 0) { handleFail(); } else { - process.nextTick(() => { - if (restartRequired) { - moduleUpdater.quitAndInstallUpdates(); - } else { - moduleUpdater.installPendingUpdates(); - } - }); + process.nextTick(() => moduleUpdater[restartRequired ? 'quitAndInstallUpdates' : 'installPendingUpdates']()); } }); @@ -307,7 +301,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only) currentId = current; installs.record(currentId, '', 0); - installs.sendState(); + installs.send(); }); const segmentCallback = (tracker) => (({ name }) => { @@ -323,7 +317,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only) const progressCallback = (tracker) => (({ progress }) => { tracker.record(currentId, '', progress); - tracker.sendState(); + tracker.send(); }); add(DOWNLOADING_MODULE_PROGRESS, progressCallback(downloads));