Extract schedule update check helper

This commit is contained in:
Kevin Sawicki
2015-05-13 08:30:51 -07:00
parent 7739646699
commit 672cb89e84

View File

@@ -53,11 +53,7 @@ class AutoUpdateManager
@emitUpdateAvailableEvent(@getWindows()...)
# Only released versions should check for updates.
unless /\w{7}/.test(@version)
checkForUpdates = => @check(hidePopups: true)
thirtyMinutes = 1000 * 60 * 30
setInterval(checkForUpdates, thirtyMinutes)
checkForUpdates()
@scheduleUpdateCheck() unless /\w{7}/.test(@version)
switch process.platform
when 'win32'
@@ -79,6 +75,12 @@ class AutoUpdateManager
getState: ->
@state
scheduleUpdateCheck: ->
checkForUpdates = => @check(hidePopups: true)
thirtyMinutes = 1000 * 60 * 30
setInterval(checkForUpdates, thirtyMinutes)
checkForUpdates()
check: ({hidePopups}={}) ->
unless hidePopups
autoUpdater.once 'update-not-available', @onUpdateNotAvailable