()
| 171 | }; |
| 172 | |
| 173 | const 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 | |
| 223 | const fail = (c) => { |
| 224 | sendState('fail', { seconds: 10 }); |
no test coverage detected