From 7358e683944fe3815304edaea22c315d39101c6a Mon Sep 17 00:00:00 2001 From: Dick Choi Date: Thu, 15 Sep 2016 08:43:53 +0900 Subject: [PATCH] fix update api bug --- browser/main/StatusBar/index.js | 17 +++++++++++------ lib/main-app.js | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/browser/main/StatusBar/index.js b/browser/main/StatusBar/index.js index afdc5c3a..f572e853 100644 --- a/browser/main/StatusBar/index.js +++ b/browser/main/StatusBar/index.js @@ -17,16 +17,21 @@ class StatusBar extends React.Component { this.state = { updateReady: false } - } - - componentDidMount () { - ipc.on('update-ready', function (message) { + this.updateReadyHandler = (message) => { this.setState({ updateReady: true }, () => { this.updateApp() }) - }.bind(this)) + } + } + + componentDidMount () { + ipc.on('update-ready', this.updateReadyHandler) + } + + componentWillUnmount () { + ipc.removeListener('update-ready', this.updateReadyHandler) } updateApp () { @@ -38,7 +43,7 @@ class StatusBar extends React.Component { }) if (index === 0) { - remote.getCurrentWindow().webContents.send('update-app') + ipc.send('update-app-confirm') } } diff --git a/lib/main-app.js b/lib/main-app.js index 6e0fd926..8c078247 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -67,6 +67,7 @@ updater.on('update-downloaded', (info) => { }) ipc.on('update-app-confirm', function (event, msg) { + console.log('confirmed') if (isUpdateReady) { updater.install() }