Header menu logo fable-electron-docs-api

autoUpdater Type

⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ❌ | Exported ✔

Enable apps to automatically update themselves.Process: Main**See also: A detailed guide about how to implement updates in your application.**autoUpdater is an EventEmitter.### Platform NoticesCurrently, only macOS and Windows are supported. There is no built-in support for auto-updater on Linux, so it is recommended to use the distribution's package manager to update your app.In addition, there are some subtle differences on each platform:### macOSOn macOS, the autoUpdater module is built upon Squirrel.Mac, meaning you don't need any special setup to make it work. For server-side requirements, you can read Server Support. Note that 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.> [!IMPORTANT] Your application must be signed for automatic updates on macOS. This is a requirement of Squirrel.Mac.### WindowsOn Windows, you have to install your app into a user's machine before you can use the autoUpdater, so it is recommended that you use electron-winstaller or Electron Forge's Squirrel.Windows maker to generate a Windows installer.Apps built with Squirrel.Windows will trigger custom launch events that must be handled by your Electron application to ensure proper setup and teardown.Squirrel.Windows apps will launch with the --squirrel-firstrun argument immediately after installation. During this time, Squirrel.Windows will obtain a file lock on your app, and autoUpdater requests will fail until the lock is released. In practice, this means that 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 your update checks (see electron/electron#7155 for more information).The installer generated with Squirrel.Windows will create a shortcut icon with an Application User Model ID in the format of com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE, examples are com.squirrel.slack.Slack and com.squirrel.code.Code. You have to use the same ID for your app with app.setAppUserModelId API, otherwise Windows will not be able to pin your app properly in task bar.

Static members

Static member Description

autoUpdater.checkForUpdates ()

Full Usage: autoUpdater.checkForUpdates ()

Modifiers: inline

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

autoUpdater.getFeedURL ()

Full Usage: autoUpdater.getFeedURL ()

Returns: string
Modifiers: inline

The current update feed URL.

Returns: string

autoUpdater.offBeforeQuitForUpdate handler

Full Usage: autoUpdater.offBeforeQuitForUpdate handler

Parameters:
    handler : unit -> unit

Modifiers: inline

This 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. As a result 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.

handler : unit -> unit

autoUpdater.offCheckingForUpdate handler

Full Usage: autoUpdater.offCheckingForUpdate handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when checking for an available update has started.

handler : unit -> unit

autoUpdater.offError handler

Full Usage: autoUpdater.offError handler

Parameters:
    handler : Error -> unit

Modifiers: inline

Emitted when there is an error while updating.

handler : Error -> unit

autoUpdater.offUpdateAvailable handler

Full Usage: autoUpdater.offUpdateAvailable handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when there is an available update. The update is downloaded automatically.

handler : unit -> unit

autoUpdater.offUpdateDownloaded handler

Full Usage: autoUpdater.offUpdateDownloaded handler

Parameters:
Modifiers: inline

Emitted when an update has been downloaded.On Windows only releaseName is available.> [!NOTE] It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.

handler : IOnUpdateDownloaded -> unit

autoUpdater.offUpdateDownloaded handler

Full Usage: autoUpdater.offUpdateDownloaded handler

Parameters:
    handler : Event -> string -> string -> DateTime -> string -> unit

Modifiers: inline

Emitted when an update has been downloaded.On Windows only releaseName is available.> [!NOTE] It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.

handler : Event -> string -> string -> DateTime -> string -> unit

autoUpdater.offUpdateNotAvailable handler

Full Usage: autoUpdater.offUpdateNotAvailable handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when there is no available update.

handler : unit -> unit

autoUpdater.onBeforeQuitForUpdate handler

Full Usage: autoUpdater.onBeforeQuitForUpdate handler

Parameters:
    handler : unit -> unit

Modifiers: inline

This 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. As a result 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.

handler : unit -> unit

autoUpdater.onCheckingForUpdate handler

Full Usage: autoUpdater.onCheckingForUpdate handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when checking for an available update has started.

handler : unit -> unit

autoUpdater.onError handler

Full Usage: autoUpdater.onError handler

Parameters:
    handler : Error -> unit

Modifiers: inline

Emitted when there is an error while updating.

handler : Error -> unit

autoUpdater.onUpdateAvailable handler

Full Usage: autoUpdater.onUpdateAvailable handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when there is an available update. The update is downloaded automatically.

handler : unit -> unit

autoUpdater.onUpdateDownloaded handler

Full Usage: autoUpdater.onUpdateDownloaded handler

Parameters:
Modifiers: inline

Emitted when an update has been downloaded.On Windows only releaseName is available.> [!NOTE] It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.

handler : IOnUpdateDownloaded -> unit

autoUpdater.onUpdateDownloaded handler

Full Usage: autoUpdater.onUpdateDownloaded handler

Parameters:
    handler : Event -> string -> string -> DateTime -> string -> unit

Modifiers: inline

Emitted when an update has been downloaded.On Windows only releaseName is available.> [!NOTE] It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.

handler : Event -> string -> string -> DateTime -> string -> unit

autoUpdater.onUpdateNotAvailable handler

Full Usage: autoUpdater.onUpdateNotAvailable handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when there is no available update.

handler : unit -> unit

autoUpdater.onceBeforeQuitForUpdate handler

Full Usage: autoUpdater.onceBeforeQuitForUpdate handler

Parameters:
    handler : unit -> unit

Modifiers: inline

This 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. As a result 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.

handler : unit -> unit

autoUpdater.onceCheckingForUpdate handler

Full Usage: autoUpdater.onceCheckingForUpdate handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when checking for an available update has started.

handler : unit -> unit

autoUpdater.onceError handler

Full Usage: autoUpdater.onceError handler

Parameters:
    handler : Error -> unit

Modifiers: inline

Emitted when there is an error while updating.

handler : Error -> unit

autoUpdater.onceUpdateAvailable handler

Full Usage: autoUpdater.onceUpdateAvailable handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when there is an available update. The update is downloaded automatically.

handler : unit -> unit

autoUpdater.onceUpdateDownloaded handler

Full Usage: autoUpdater.onceUpdateDownloaded handler

Parameters:
Modifiers: inline

Emitted when an update has been downloaded.On Windows only releaseName is available.> [!NOTE] It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.

handler : IOnUpdateDownloaded -> unit

autoUpdater.onceUpdateDownloaded handler

Full Usage: autoUpdater.onceUpdateDownloaded handler

Parameters:
    handler : Event -> string -> string -> DateTime -> string -> unit

Modifiers: inline

Emitted when an update has been downloaded.On Windows only releaseName is available.> [!NOTE] It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.

handler : Event -> string -> string -> DateTime -> string -> unit

autoUpdater.onceUpdateNotAvailable handler

Full Usage: autoUpdater.onceUpdateNotAvailable handler

Parameters:
    handler : unit -> unit

Modifiers: inline

Emitted when there is no available update.

handler : unit -> unit

autoUpdater.quitAndInstall ()

Full Usage: autoUpdater.quitAndInstall ()

Modifiers: inline

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 calling autoUpdater.quitAndInstall() will close all application windows first, and automatically call app.quit() after all windows have been closed.> [!NOTE] 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.

autoUpdater.setFeedURL (url, ?headers, ?serverType)

Full Usage: autoUpdater.setFeedURL (url, ?headers, ?serverType)

Parameters:
Modifiers: inline

Sets the url and initialize the auto updater.

url : string
?headers : Record<string, string>
?serverType : ServerType

Type something to start searching.