mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Extract schedule update check helper
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user