Skip to content

Commit e6228f4

Browse files
authored
Merge pull request #264 from hypermodules/auto-update-ipc
Auto update ipc
2 parents 548faf0 + 6bee7cf commit e6228f4

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

main/index.js

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -228,48 +228,45 @@ app.on('ready', function appReady () {
228228
})
229229
})
230230

231-
setTimeout(() => {
232-
autoUpdater.checkForUpdatesAndNotify()
233-
}, 500)
234-
235231
if (process.platform !== 'darwin') { // TODO System tray on windows (maybe linux)
236232
// since window-all-closed doesn't fire with our hidden audio process
237233
player.win.once('closed', () => {
238234
app.quit()
239235
})
240236
}
241-
})
242237

243-
autoUpdater.on('error', (err) => {
244-
console.log(err)
245-
})
238+
setTimeout(() => {
239+
autoUpdater.checkForUpdatesAndNotify()
240+
}, 500)
246241

247-
autoUpdater.on('checking-for-update', () => {
248-
console.log('autoUpdater: Checking for update...')
249-
})
242+
autoUpdater.on('error', (err) => {
243+
console.log(err)
244+
broadcast('au:error', err)
245+
})
250246

251-
autoUpdater.on('update-available', (info) => {
252-
console.log(`autoUpdater: Update available!`)
253-
console.log(info)
254-
})
247+
autoUpdater.on('checking-for-update', () => {
248+
console.log('autoUpdater: Checking for update...')
249+
broadcast('au:checking-for-update')
250+
})
255251

256-
autoUpdater.on('update-not-available', (info) => {
257-
console.log(`autoUpdater: No update available`)
258-
console.log(info)
259-
})
252+
autoUpdater.on('update-available', (info) => {
253+
console.log(`autoUpdater: Update available!`)
254+
broadcast('au:update-available', info)
255+
})
260256

261-
autoUpdater.on('update-not-available', (info) => {
262-
console.log(`autoUpdater: No update available`)
263-
console.log(info)
264-
})
257+
autoUpdater.on('update-not-available', (info) => {
258+
console.log(`autoUpdater: No update available`)
259+
broadcast('au:update-not-available', info)
260+
})
265261

266-
autoUpdater.on('download-progress', (progress) => {
267-
console.log(progress)
268-
})
262+
autoUpdater.on('download-progress', (progress) => {
263+
broadcast('au:progress', progress)
264+
})
269265

270-
autoUpdater.on('update-downloaded', (info) => {
271-
console.log(`autoUpdater: Update downloaded`)
272-
console.log(info)
266+
autoUpdater.on('update-downloaded', (info) => {
267+
console.log(`autoUpdater: Update downloaded`)
268+
broadcast('au:update-downloaded', info)
269+
})
273270
})
274271

275272
app.on('activate', function activate () {

0 commit comments

Comments
 (0)