Auto-update hourly
This commit is contained in:
parent
6686621b0b
commit
dcc6f599a2
2 changed files with 14 additions and 1 deletions
12
main.js
12
main.js
|
@ -6,6 +6,8 @@ const BrowserWindow = electron.BrowserWindow
|
|||
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
const autoUpdater = require('electron-updater').autoUpdater
|
||||
const autoUpdaterInterval = 60 * 60 * 1000;
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
|
@ -37,7 +39,15 @@ function createWindow () {
|
|||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', createWindow)
|
||||
app.on('ready', function() {
|
||||
autoUpdater.addListener('update-downloaded', function() {
|
||||
autoUpdater.quitAndInstall()
|
||||
});
|
||||
autoUpdater.checkForUpdates();
|
||||
|
||||
setInterval(function() { autoUpdater.checkForUpdates(); }, autoUpdaterInterval);
|
||||
createWindow();
|
||||
})
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function () {
|
||||
|
|
|
@ -66,5 +66,8 @@
|
|||
"publish": [
|
||||
"github"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-updater": "^1.11.2"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue