Spike out an update wrapper

We can expose just a few event subscription methods on atom.update to
take care of what most packages (e.g. About) would be interested in. Of
course the updater runs on the main thread so we’re proxying them
through IPC. It’s fine.
This commit is contained in:
Daniel Hengeveld
2016-02-02 11:56:05 -08:00
committed by Ben Ogle
parent 19623b3543
commit 3716aaf00b
4 changed files with 101 additions and 0 deletions

View File

@@ -182,6 +182,34 @@ class ApplicationDelegate
new Disposable ->
ipcRenderer.removeListener('message', outerCallback)
onDidBeginCheckingForUpdate: (callback) ->
outerCallback = (message, detail) ->
if message is 'checking-for-update'
callback(detail)
ipc.on('message', outerCallback)
new Disposable ->
ipc.removeListener('message', outerCallback)
onDidCompleteDownloadingUpdate: (callback) ->
outerCallback = (message, detail) ->
if message is 'update-downloaded'
callback(detail)
ipc.on('message', outerCallback)
new Disposable ->
ipc.removeListener('message', outerCallback)
onUpdateNotAvailable: (callback) ->
outerCallback = (message, detail) ->
if message is 'update-not-available'
callback(detail)
ipc.on('message', outerCallback)
new Disposable ->
ipc.removeListener('message', outerCallback)
onApplicationMenuCommand: (callback) ->
outerCallback = (event, args...) ->
callback(args...)