store window ref globally so when splitting files its easier to access.

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-06-12 13:47:29 +01:00
parent 53e2ce33b8
commit b6d2ba2019
3 changed files with 15 additions and 21 deletions

View file

@ -67,17 +67,11 @@ module.exports.start = function startAutoUpdate(updateBaseUrl) {
}
ipcMain.on('install_update', installUpdate);
let ipcChannel;
ipcMain.on('check_updates', function(event) {
ipcChannel = event.sender;
pollForUpdates();
// event.sender.send('check_updates') // true/false/error = available(downloading)/notAvailable/error
});
ipcMain.on('check_updates', pollForUpdates);
function ipcChannelSendUpdateStatus(status) {
if (ipcChannel) {
ipcChannel.send('check_updates', status);
if (global.mainWindow) {
global.mainWindow.webContents.send('check_updates', status);
}
}