new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · all subjects

auto-update & releases

19 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

autoUpdater module purpose and process location

The autoUpdater module enables apps to automatically update themselves. It runs in the Main process and is an EventEmitter.

autoUpdater platform support

Currently, only macOS and Windows are supported for auto-updater functionality. There is no built-in support for auto-updater on Linux, so it is recommended to use the distribution's package manager to update the app.

macOS autoUpdater built on Squirrel.Mac

On macOS, the autoUpdater module is built upon Squirrel.Mac, meaning no special setup is required to make it work. However, your application must be signed for automatic updates on macOS, as this is a requirement of Squirrel.Mac.

macOS App Transport Security for autoUpdater

On macOS, App Transport Security (ATS) applies to all requests made as part of the update process. Apps that need to disable ATS can add the NSAllowsArbitraryLoads key to their app's plist.

Windows autoUpdater automatic mechanism selection

On Windows, the autoUpdater module automatically selects the appropriate update mechanism based on how the app is packaged. For MSIX packages, it uses the MSIX updater. For apps installed via traditional installers, it uses Squirrel.Windows. You don't need to configure which updater to use; Electron automatically detects the packaging format.

Squirrel.Windows first run behavior and update checks

Squirrel.Windows apps launch with the --squirrel-firstrun argument immediately after installation. During this time, Squirrel.Windows obtains a file lock on the app, and autoUpdater requests will fail until the lock is released. This means you won't be able to check for updates on first launch for the first few seconds. You can work around this by not checking for updates when process.argv contains the --squirrel-firstrun flag or by setting a 10-second timeout on update checks.

Squirrel.Windows Application User Model ID requirement

The installer generated with Squirrel.Windows creates a shortcut icon with an Application User Model ID in the format of com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE (examples: com.squirrel.slack.Slack and com.squirrel.code.Code). You must use the same ID for your app with app.setAppUserModelId API, otherwise Windows will not be able to pin your app properly in the task bar.

MSIX autoUpdater allowAnyVersion option

When an app is packaged as MSIX, the autoUpdater module provides an allowAnyVersion option in setFeedURL() to allow updates to older versions (downgrades). MSIX packages support direct MSIX file links or JSON update feeds similar to Squirrel.Mac format.

autoUpdater 'error' event

The 'error' event is emitted when there is an error while updating. It returns an Error object.

autoUpdater 'checking-for-update' event

The 'checking-for-update' event is emitted when checking for an available update has started.

autoUpdater 'update-available' event

The 'update-available' event is emitted when there is an available update. The update is downloaded automatically.

autoUpdater 'update-not-available' event

The 'update-not-available' event is emitted when there is no available update.

autoUpdater 'update-downloaded' event

The 'update-downloaded' event is emitted when an update has been downloaded. It returns: event (Event), releaseNotes (string), releaseName (string), releaseDate (Date), updateURL (string). With Squirrel.Windows only releaseName is available.

autoUpdater 'update-downloaded' event handling not required

It is not strictly necessary to handle the 'update-downloaded' event. A successfully downloaded update will still be applied the next time the application starts.

autoUpdater 'before-quit-for-update' event

The 'before-quit-for-update' event is emitted after a user calls quitAndInstall(). When this API is called, the before-quit event is not emitted before all windows are closed. You should listen to this event if you wish to perform actions before the windows are closed while a process is quitting, as well as listening to before-quit.

autoUpdater.setFeedURL() method options

autoUpdater.setFeedURL(options) sets the URL and initializes the auto updater. Options object contains: url (string, required) - the update server URL (for Windows MSIX, can be a direct link to an MSIX file like https://example.com/update.msix or a JSON endpoint); headers (Record<string, string>, optional, macOS only) - HTTP request headers; serverType (string, optional, macOS only) - can be 'json' or 'default'; allowAnyVersion (boolean, optional, Windows only) - if true, allows downgrades to older versions for MSIX packages, defaults to false.

autoUpdater.getFeedURL() method

autoUpdater.getFeedURL() returns the current update feed URL as a string.

autoUpdater.checkForUpdates() method requirements

autoUpdater.checkForUpdates() asks the server whether there is an update. You must call setFeedURL before using this API. If an update is available it will be downloaded automatically. Calling autoUpdater.checkForUpdates() twice will download the update two times.

autoUpdater.quitAndInstall() method behavior

autoUpdater.quitAndInstall() restarts the app and installs the update after it has been downloaded. It should only be called after 'update-downloaded' has been emitted. Under the hood, it closes all application windows first and automatically calls app.quit() after all windows have been closed. It is not strictly necessary to call this function to apply an update, as a successfully downloaded update will always be applied the next time the application starts.

Give your agent this brain