[Splash > Backend] Clean up source a bit

This commit is contained in:
Ducko 2022-02-16 10:34:23 +00:00
parent cc77907845
commit 9f7920d287
1 changed files with 5 additions and 11 deletions

View File

@ -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) { if (this.progress.size > 0 && this.progress.size > this.done.size) {
splashState = { splashState = {
current: this.done.size + 1, current: this.done.size + 1,
@ -201,7 +201,7 @@ const updateUntilCurrent = async () => {
if (download != null) downloads.record(download.package_sha256, state, percent); if (download != null) downloads.record(download.package_sha256, state, percent);
if (!downloads.sendState()) installs.sendState(); if (!downloads.send()) installs.send();
if (install == null) return; if (install == null) return;
@ -293,13 +293,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only)
if (failed > 0) { if (failed > 0) {
handleFail(); handleFail();
} else { } else {
process.nextTick(() => { process.nextTick(() => moduleUpdater[restartRequired ? 'quitAndInstallUpdates' : 'installPendingUpdates']());
if (restartRequired) {
moduleUpdater.quitAndInstallUpdates();
} else {
moduleUpdater.installPendingUpdates();
}
});
} }
}); });
@ -307,7 +301,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only)
currentId = current; currentId = current;
installs.record(currentId, '', 0); installs.record(currentId, '', 0);
installs.sendState(); installs.send();
}); });
const segmentCallback = (tracker) => (({ name }) => { const segmentCallback = (tracker) => (({ name }) => {
@ -323,7 +317,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only)
const progressCallback = (tracker) => (({ progress }) => { const progressCallback = (tracker) => (({ progress }) => {
tracker.record(currentId, '', progress); tracker.record(currentId, '', progress);
tracker.sendState(); tracker.send();
}); });
add(DOWNLOADING_MODULE_PROGRESS, progressCallback(downloads)); add(DOWNLOADING_MODULE_PROGRESS, progressCallback(downloads));