const { autoUpdater } = require('electron-updater'); let win: boolean; // Listen for window creation. backgroundMitt.on('window-active', (state: boolean) => { win = state; }); // Auto updating. autoUpdater.requestHeaders = { 'PRIVATE-TOKEN': 'mvvgWYwWnot4bisiQMh_' } autoUpdater.on('update-available', (info: any) => { console.log(`Update available: ${info.version}`) }) autoUpdater.on('update-downloaded', (info: any) => { const updateDialog = { type: 'info', buttons: ['Restart', 'Later'], title: 'Application Update', message: info.version, detail: 'A new version has been downloaded. Restart the application to apply the updates.' } dialog.showMessageBox(updateDialog).then((returnValue) => { if (returnValue.response === 0) autoUpdater.quitAndInstall() }) })