domain/updates/update-service
Classes
Section titled “Classes”UpdateService
Section titled “UpdateService”Defined in: app/src/domain/updates/update-service.ts:96
Checks for updates on a schedule and downloads them in the background. A downloaded update installs when the browser quits. The service never shows a dialog.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new UpdateService(
engine,clock,logger,options):UpdateService
Defined in: app/src/domain/updates/update-service.ts:116
Parameters
Section titled “Parameters”engine
Section titled “engine”Finds, downloads and installs updates.
Time and timers.
logger
Section titled “logger”Logger.
options
Section titled “options”Policies and installation facts.
Returns
Section titled “Returns”Properties
Section titled “Properties”onDidChange
Section titled “onDidChange”
readonlyonDidChange:Event<UpdateState>
Defined in: app/src/domain/updates/update-service.ts:108
Fires whenever UpdateService.state changes.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get state():
UpdateState
Defined in: app/src/domain/updates/update-service.ts:133
The current state.
Returns
Section titled “Returns”Methods
Section titled “Methods”check()
Section titled “check()”check():
Promise<UpdateState>
Defined in: app/src/domain/updates/update-service.ts:147
Checks now and downloads an update if there is one. Concurrent calls share one run.
Returns
Section titled “Returns”Promise<UpdateState>
The state after the run.
dispose()
Section titled “dispose()”dispose():
void
Defined in: app/src/domain/updates/update-service.ts:170
Cancels the schedule.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”installOnExit()
Section titled “installOnExit()”installOnExit():
boolean
Defined in: app/src/domain/updates/update-service.ts:161
Installs a downloaded update while the browser exits.
Returns
Section titled “Returns”boolean
Whether an installation started.
start()
Section titled “start()”start():
void
Defined in: app/src/domain/updates/update-service.ts:138
Schedules the first automatic check, unless updates are off or manual.
Returns
Section titled “Returns”void
Interfaces
Section titled “Interfaces”UpdateEngine
Section titled “UpdateEngine”Defined in: app/src/domain/updates/update-service.ts:37
Finds, downloads and installs verified updates; electron-updater in the browser.
Methods
Section titled “Methods”check()
Section titled “check()”check():
Promise<string|undefined>
Defined in: app/src/domain/updates/update-service.ts:42
Looks for a newer version in the signed feed.
Returns
Section titled “Returns”Promise<string | undefined>
The version, or undefined when the browser is up to date.
download()
Section titled “download()”download(
onProgress):Promise<void>
Defined in: app/src/domain/updates/update-service.ts:47
Downloads the update found by the last check and verifies it.
Parameters
Section titled “Parameters”onProgress
Section titled “onProgress”(percent) => void
Receives the progress in percent.
Returns
Section titled “Returns”Promise<void>
install()
Section titled “install()”install():
void
Defined in: app/src/domain/updates/update-service.ts:52
Starts the silent installation of the downloaded update. Called while the browser exits, after everything is saved.
Returns
Section titled “Returns”void
UpdateHooks
Section titled “UpdateHooks”Defined in: app/src/domain/updates/update-service.ts:56
Work around an installation that keeps a rollback possible.
Methods
Section titled “Methods”afterDownload()
Section titled “afterDownload()”afterDownload(
version):Promise<void>
Defined in: app/src/domain/updates/update-service.ts:62
Runs after a download while the browser keeps running, such as fetching the package of the running version. A failure is logged; the update still installs.
Parameters
Section titled “Parameters”version
Section titled “version”string
The downloaded version.
Returns
Section titled “Returns”Promise<void>
beforeInstall()
Section titled “beforeInstall()”beforeInstall(
version):void
Defined in: app/src/domain/updates/update-service.ts:67
Runs right before the installation starts, while the browser exits.
Parameters
Section titled “Parameters”version
Section titled “version”string
The version being installed.
Returns
Section titled “Returns”void
UpdateServiceOptions
Section titled “UpdateServiceOptions”Defined in: app/src/domain/updates/update-service.ts:71
Settings of the update service, resolved from policies and the installation.
Properties
Section titled “Properties”hasKeys
Section titled “hasKeys”
readonlyhasKeys:boolean
Defined in: app/src/domain/updates/update-service.ts:75
Whether the build carries update keys; without them, nothing can be verified.
hooks?
Section titled “hooks?”
readonlyoptionalhooks?:UpdateHooks
Defined in: app/src/domain/updates/update-service.ts:83
Rollback preparation around downloads and installations.
installType
Section titled “installType”
readonlyinstallType:InstallType
Defined in: app/src/domain/updates/update-service.ts:73
isOnline
Section titled “isOnline”
readonlyisOnline: () =>boolean
Defined in: app/src/domain/updates/update-service.ts:79
Whether the system reports a network connection.
Returns
Section titled “Returns”boolean
readonlymode:UpdateMode
Defined in: app/src/domain/updates/update-service.ts:72
periodMinutes
Section titled “periodMinutes”
readonlyperiodMinutes:number
Defined in: app/src/domain/updates/update-service.ts:77
Minutes between automatic checks.
random?
Section titled “random?”
readonlyoptionalrandom?: () =>number
Defined in: app/src/domain/updates/update-service.ts:81
Random number in [0, 1) for the jitter; replaceable in tests.
Returns
Section titled “Returns”number
Type Aliases
Section titled “Type Aliases”InstallType
Section titled “InstallType”InstallType =
"nsis"|"msi"|"mac"|"appimage"|"deb"|"rpm"|"unpacked"
Defined in: app/src/domain/updates/update-service.ts:8
How the browser was installed, which decides who installs updates.
UpdateMode
Section titled “UpdateMode”UpdateMode =
"off"|"automatic"|"manual"
Defined in: app/src/domain/updates/update-service.ts:20
The UpdatePolicy values: off, automatic, or only when the user asks.
UpdateState
Section titled “UpdateState”UpdateState = {
kind:"disabled";reason:"policy"|"install-type"|"no-keys"; } | {kind:"idle";lastCheckAt?:number; } | {kind:"checking"; } | {kind:"downloading";percent:number;version:string; } | {kind:"ready";version:string; } | {at:number;code:string;kind:"failed";message:string; }
Defined in: app/src/domain/updates/update-service.ts:23
What the updater is doing.
Variables
Section titled “Variables”UpdateServiceToken
Section titled “UpdateServiceToken”
constUpdateServiceToken:Token<UpdateService>
Defined in: app/src/domain/updates/update-service.ts:240
Token for the UpdateService.
Functions
Section titled “Functions”updatesItself()
Section titled “updatesItself()”updatesItself(
type):boolean
Defined in: app/src/domain/updates/update-service.ts:15
Whether the browser installs updates of this installation type itself. IT updates MSI installations, and the package manager updates deb and rpm installations.
Parameters
Section titled “Parameters”The installation type.
Returns
Section titled “Returns”boolean