From 6fce680a2890b698eea10a056f85dc63ae0e67a3 Mon Sep 17 00:00:00 2001 From: Daniel Hengeveld Date: Wed, 3 Feb 2016 14:21:46 -0800 Subject: [PATCH] Send check-for-update message over ipc --- src/browser/atom-application.coffee | 3 +++ src/browser/auto-update-manager.coffee | 3 ++- src/update.js | 7 ++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 40b04c3a1..ebcc9717b 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -304,6 +304,9 @@ class AtomApplication ipcMain.on 'execute-javascript-in-dev-tools', (event, code) -> event.sender.devToolsWebContents?.executeJavaScript(code) + ipcMain.on 'check-for-update', => + @autoUpdateManager.check() + setupDockMenu: -> if process.platform is 'darwin' dockMenu = Menu.buildFromTemplate [ diff --git a/src/browser/auto-update-manager.coffee b/src/browser/auto-update-manager.coffee index 064ccf27c..c17d9aead 100644 --- a/src/browser/auto-update-manager.coffee +++ b/src/browser/auto-update-manager.coffee @@ -3,6 +3,7 @@ _ = require 'underscore-plus' Config = require '../config' {EventEmitter} = require 'events' path = require 'path' +ipc = require 'ipc' IdleState = 'idle' CheckingState = 'checking' @@ -47,7 +48,7 @@ class AutoUpdateManager autoUpdater.on 'update-available', => @setState(DownladingState) - # We use sendMessage to send an event called 'update-available' below + # We use sendMessage to send an event called 'update-available' in 'update-downloaded' # once the update download is complete. This mismatch between the electron # autoUpdater events is unfortunate but in the interest of not changing the # one existing event handled by applicationDelegate diff --git a/src/update.js b/src/update.js index 4abffc0b0..452a3647f 100644 --- a/src/update.js +++ b/src/update.js @@ -1,6 +1,7 @@ 'use babel' import {Emitter, CompositeDisposable} from 'event-kit' +import ipc from 'ipc' export default class Update { constructor () { @@ -55,10 +56,6 @@ export default class Update { } check () { - // TODO - } - - getState () { - // TODO + ipc.send('check-for-update') } }