Updater (window.Electron.updater)
electron-updater-backed auto-update checks. Source: src/main/updater.ts, channel prefix updater:*. Opt-in — set autoUpdater.enabled: true in electron.config.ts (see App configuration for channel/autoDownload/autoInstallOnQuit/allowPrerelease/allowDowngrade). Only active in production (app.isPackaged) — every method is a no-op while running under dae run.
Methods
| Method | Returns | Notes |
|---|---|---|
checkForUpdate() |
Promise<void> |
Triggers a check; results arrive via on() events below, not the resolved value. |
downloadUpdate() |
Promise<void> |
Downloads the update found by the last check. |
quitAndInstall() |
void |
Fire-and-forget — the renderer never awaits a result, so it's not part of the throw/.safe convention at all. |
on<K extends UpdaterEventName>(event: K, callback: (data: UpdaterEventMap[K]) => void) |
() => void (unsubscribe) |
Subscribe to one event type. |
Events (UpdaterEventMap)
| Event | Payload |
|---|---|
'checking-for-update' |
void |
'update-available' |
UpdateInfo |
'update-not-available' |
UpdateInfo |
'download-progress' |
DownloadProgress |
'update-downloaded' |
UpdateInfo |
'error' |
{ message: string } |
UpdateInfo: { version: string; releaseNotes?: string | string[] | null; releaseDate?: string; [key: string]: unknown }.
DownloadProgress: { bytesPerSecond: number; percent: number; transferred: number; total: number }.
Example
const unsubscribe = window.Electron.updater.on('update-downloaded', (info) => {
console.log('Downloaded', info.version, '— restart to install');
});
await window.Electron.updater.checkForUpdate();
// later, once 'update-available' fires:
await window.Electron.updater.downloadUpdate();
// once 'update-downloaded' fires:
window.Electron.updater.quitAndInstall();
unsubscribe();
.safe
Partial. checkForUpdate() and downloadUpdate() are wrapped — window.Electron.safe.updater.checkForUpdate() resolves { ok: true } | { ok: false, error } instead of throwing. quitAndInstall() and on() are the same function reference on both window.Electron.updater and window.Electron.safe.updater — neither can fail in a way worth reporting, so there's nothing to unwrap.