May 25, 2021 Electron
This module provides an interface to the Squirrel automatic update framework.
Although the autoUpdater module provides a set of interfaces common to each platform, there are still small differences between each platform.
On OS X, the autoUpdater module relies on the built-in Squirrel.Mac, which means you don't have to rely on other settings to use it. You can learn about updating the configuration of your server by reading the Server Support article.
On Windows, you must use the installer to install your app on the user's computer, so the recommended approach is to automatically generate a Windows installation wizard using the grunt-electron-installer module.
Squirrel's auto-generated installation wizard generates a shortcut with the Application User Model ID. T he format of the Application User Model ID is com.squirrel.PACKAGE_ID.YOUR-EXE-WITHOUT-DOT-EXE, such as com.squirrel.slack.Slack and com.squirrel.code.Code. You should set up the same API in your app using the app.setAppUserModelId method, or Windows won't pin your app correctly to the taskbar.
The server-side configuration is also different from OS X, and you can read the Squirrel.Windows document for more information.
There is no automatic update support under Linux, so we recommend distributing your app with the package manager for each Linux distribution.
The autoUpdater object triggers the following events:
Return:
Triggered when an update occurs with an error.
Triggered when you start checking for updates.
When an available update is found, the update package download starts automatically.
Triggered when no updates are available.
Return:
Triggered when the update download is complete.
Only releaseName is valid on Windows.
The autoUpdater object has the following methods:
Set the url to check for updates and initialize automatic updates. This url cannot be changed once it is set.
Check the service side for updates that are now available. Before you can call this method, you must call the setFeedURL.
After the download is complete, restart the current app and install the update. This method should only be called after the update-downloaded event is triggered.