()
| 43 | const isCanary = (updateChannel: string) => updateChannel === 'canary'; |
| 44 | |
| 45 | async function init() { |
| 46 | autoUpdater.on('error', (err) => { |
| 47 | console.error('Error fetching updates', `${err.message} (${err.stack})`); |
| 48 | }); |
| 49 | |
| 50 | const config = await getDecoratedConfigWithRetry(); |
| 51 | |
| 52 | // If defined in the config, switch to the "canary" channel |
| 53 | if (config.updateChannel && isCanary(config.updateChannel)) { |
| 54 | canaryUpdates = true; |
| 55 | } |
| 56 | |
| 57 | const feedURL = buildFeedUrl(canaryUpdates, version); |
| 58 | |
| 59 | autoUpdater.setFeedURL({url: feedURL}); |
| 60 | |
| 61 | setTimeout(() => { |
| 62 | void checkForUpdates(); |
| 63 | }, ms('10s')); |
| 64 | |
| 65 | setInterval(() => { |
| 66 | void checkForUpdates(); |
| 67 | }, ms('30m')); |
| 68 | |
| 69 | isInit = true; |
| 70 | } |
| 71 | |
| 72 | export default (win: BrowserWindow) => { |
| 73 | if (!isInit) { |
no test coverage detected