MCPcopy
hub / github.com/GooseMod/OpenAsar / initOld

Function initOld

src/splash/index.js:173–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171};
172
173const initOld = () => { // "Old" (not v2 / new, win32 only)
174 const on = (k, v) => moduleUpdater.events.on(k, v);
175
176 const check = () => moduleUpdater.checkForUpdates();
177
178 const downloads = new UIProgress(0), installs = new UIProgress(1);
179
180 const handleFail = () => {
181 fail(check);
182 };
183
184 on('checked', ({ failed, count }) => { // Finished check
185 installs.reset();
186 downloads.reset();
187
188 if (failed) handleFail();
189 else if (!count) launchMain(); // Count is 0 / undefined
190 });
191
192 on('downloaded', ({ failed }) => { // Downloaded all modules
193 toSend = 1;
194
195 if (failed > 0) handleFail();
196 });
197
198 on('installed', check); // Installed all modules
199
200 on('downloading-module', ({ name, cur, total }) => {
201 downloads.record(name, '', cur, total);
202 installs.record(name, 'Waiting');
203 });
204
205 on('installing-module', ({ name, cur, total }) => {
206 installs.record(name, '', cur, total);
207 });
208
209 const segment = (tracker) => (({ name }) => {
210 tracker.record(name, 'Complete');
211 });
212
213 on('downloaded-module', segment(downloads));
214 on('installed-module', segment(installs));
215
216 on('manual', (e) => sendState('manual', { details: e })); // Host manual update required
217
218 sendState('checking-for-updates');
219
220 check();
221};
222
223const fail = (c) => {
224 sendState('fail', { seconds: 10 });

Callers 1

index.jsFile · 0.85

Calls 8

resetMethod · 0.95
recordMethod · 0.95
onFunction · 0.85
handleFailFunction · 0.85
launchMainFunction · 0.85
segmentFunction · 0.85
sendStateFunction · 0.85
checkFunction · 0.85

Tested by

no test coverage detected