-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdater.js
45 lines (40 loc) · 1.44 KB
/
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
const { autoUpdater } = require("electron-updater");
const { dialog } = require("electron");
// Configure log debugging
autoUpdater.logger = require("electron-log");
autoUpdater.logger.transports.file.level = "debug";
// Disable auto downloading of updates
// autoUpdater.autoDownload = false;
// Single export to check for and apply any avaiable updates
module.exports = () => {
autoUpdater.checkForUpdates();
/*
autoUpdater.on('update-available', () => {
// Prompt the user to download or postpone the update
dialog.showMessageBox({
type: 'info',
title: 'Update available',
message: 'A new version of EA Tester is avaiable. Would you like to update now?',
buttons: ['Update', 'No']
}, buttonIndex => {
// If button = 0 (Update), start downloading the update
if (buttonIndex === 0)
{
autoUpdater.downloadUpdate()
} else {
autoUpdater.downloadUpdate()
}
});
});
*/
// Listen for the download being ready
autoUpdater.on('update-downloaded', () => {
// Prompt the user to install the update
dialog.showMessageBox({
type: 'info',
title: 'Update downloaded',
message: 'A new version of EA Tester was downloaded and will be installed after you quit the application.',
buttons: ['Ok']
});
})
}