Created
February 22, 2017 22:24
-
-
Save weedgrease/bf5fc9191cbfaeb8ca9325d587b4dce9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {app, autoUpdater, ipcMain, ipcRenderer} = require('electron'); | |
const ms = require('ms'); | |
const platform = process.platform === 'darwin' ? 'osx' : process.platform; | |
const version = app.getVersion(); | |
const feedUrl = `https://my-updates-here.herokuapp.com/update/${platform}`; | |
export default class Updater { | |
static remoteQuitAndInstall() { | |
ipcRenderer.send('quitAndInstall'); | |
}; | |
constructor(store, mainWindow) { | |
var self = this; | |
this.mainWindow = mainWindow; | |
this.nutsUrl = `${FEED_URL}/${version}`; | |
autoUpdater.on('update-downloaded', e => { | |
// create dialog here | |
}); | |
setTimeout(() => { | |
autoUpdater.setFeedURL(self.nutsUrls) | |
self.checkForUpdates(); | |
}, ms('10s')); | |
}; | |
startCheckTimer() { | |
var self = this; | |
setInterval(() => { | |
self.checkForUpdates(); | |
}, ms('30m')); | |
}; | |
checkForUpdates() { | |
autoUpdater.checkForUpdates() | |
}; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment