Create autoUpdateManager in AtomApplication constructor

This commit is contained in:
Max Brunsfeld 2017-03-08 15:50:08 -08:00 committed by Nathan Sobo
parent 982074061e
commit 4a1f98cb6c
2 changed files with 8 additions and 6 deletions

View File

@ -73,6 +73,11 @@ class AtomApplication
@config.load()
@fileRecoveryService = new FileRecoveryService(path.join(process.env.ATOM_HOME, "recovery"))
@storageFolder = new StorageFolder(process.env.ATOM_HOME)
@autoUpdateManager = new AutoUpdateManager(
@version,
options.test or options.benchmark or options.benchmarkTest,
@config
)
@disposable = new CompositeDisposable
@handleEvents()
@ -92,9 +97,7 @@ class AtomApplication
@config.onDidChange 'core.titleBar', @promptForRestart.bind(this)
@autoUpdateManager = new AutoUpdateManager(
@version, options.test or options.benchmark or options.benchmarkTest, @resourcePath, @config
)
process.nextTick => @autoUpdateManager.initialize()
@applicationMenu = new ApplicationMenu(@version, @autoUpdateManager)
@atomProtocolHandler = new AtomProtocolHandler(@resourcePath, @safeMode)

View File

@ -14,12 +14,11 @@ module.exports =
class AutoUpdateManager
Object.assign @prototype, EventEmitter.prototype
constructor: (@version, @testMode, resourcePath, @config) ->
constructor: (@version, @testMode, @config) ->
@state = IdleState
@iconPath = path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
process.nextTick => @setupAutoUpdater()
setupAutoUpdater: ->
initialize: ->
if process.platform is 'win32'
archSuffix = if process.arch is 'ia32' then '' else '-' + process.arch
@feedUrl = "https://atom.io/api/updates#{archSuffix}?version=#{@version}"