Add: Check-for-Updates Button in Electron App
- Manueller Update-Check per Button im Header - Modal-Zustaende: checking, downloading, ready, uptodate, error - IPC: check-for-updates, update-not-available Events
This commit is contained in:
parent
c2942737bd
commit
ce2a26ddeb
4 changed files with 65 additions and 1 deletions
|
|
@ -39,6 +39,12 @@ function setupAutoUpdater() {
|
|||
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
console.log('[AutoUpdater] App is up to date.');
|
||||
if (mainWindow) mainWindow.webContents.send('update-not-available');
|
||||
});
|
||||
|
||||
// Manual check from renderer
|
||||
ipcMain.on('check-for-updates', () => {
|
||||
try { autoUpdater.checkForUpdates(); } catch (e) { console.error('[AutoUpdater]', e.message); }
|
||||
});
|
||||
|
||||
autoUpdater.on('error', (err) => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
version: '1.5.0',
|
||||
onUpdateAvailable: (callback) => ipcRenderer.on('update-available', callback),
|
||||
onUpdateReady: (callback) => ipcRenderer.on('update-ready', callback),
|
||||
onUpdateNotAvailable: (callback) => ipcRenderer.on('update-not-available', callback),
|
||||
onUpdateError: (callback) => ipcRenderer.on('update-error', (_e, msg) => callback(msg)),
|
||||
checkForUpdates: () => ipcRenderer.send('check-for-updates'),
|
||||
installUpdate: () => ipcRenderer.send('install-update'),
|
||||
setStreaming: (active) => ipcRenderer.send('streaming-status', active),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue