/
auto-updater.js
46 lines (35 loc) · 1.04 KB
/
auto-updater.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { app } from 'electron';
import log from 'electron-log';
import { autoUpdater } from 'electron-updater';
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
log.info('Auto-updater starting...');
autoUpdater.on('checking-for-update', () => {
console.log('Checking for update...');
});
autoUpdater.on('update-available', (ev, info) => {
console.log('Update available.');
});
autoUpdater.on('update-not-available', (ev, info) => {
console.log('Update not available.');
});
autoUpdater.on('error', (ev, err) => {
console.log('Error in auto-updater.');
});
autoUpdater.on('download-progress', (ev, progressObj) => {
console.log('Download progress...');
});
autoUpdater.on('update-downloaded', (ev, info) => {
console.log('Update downloaded; will install in 5 seconds');
});
autoUpdater.on('update-downloaded', (ev, info) => {
setTimeout(function() {
autoUpdater.quitAndInstall();
}, 5000);
});
app.on('ready', function() {
if (process.env.DEVELOPMENT) {
return;
}
autoUpdater.checkForUpdates();
});