Captain is currently in ALPHA. We are happy to get your feedback
Core API
Helpers Utils Update

Module: helpers/utils/update

Table of contents

Functions

Functions

checkCoreUpdates

checkCoreUpdates(): Promise<void>

Triggers a check for updates and notifies the user if an update is available.

Returns

Promise<void>

Defined in

src/electron/helpers/utils/update.ts:113 (opens in a new tab)


checkUpdates

checkUpdates(manifest, os): Resource[]

Checks for available updates based on the installed versions of resources.

Parameters

NameTypeDescription
manifestManifestThe complete resource manifest for all operating systems.
osOSThe current operating system to check updates for, which must be one of 'windows', 'macOS', or 'linux'.

Returns

Resource[]

An array of resources that have updates available.

Defined in

src/electron/helpers/utils/update.ts:21 (opens in a new tab)


downloadCoreUpdate

downloadCoreUpdate(): Promise<void>

Downloads the update if any updates are available.

Returns

Promise<void>

Defined in

src/electron/helpers/utils/update.ts:120 (opens in a new tab)


listenForUpdates

listenForUpdates(): void

Sets up listeners for various events from electron-updater to handle different stages of the update process. This function configures the update behavior and binds event handlers to specific update events to manage the application's response to these events effectively.

Events handled:

  • "update-available": Logs the availability of an update and opens the core settings window to notify the user.
  • "update-downloaded": Logs the completion of an update download, opens the core settings, and notifies the user that the update is ready to install.
  • "error": Logs any errors that occur during the update process and notifies the user via the core settings window.
  • "checking-for-update": Logs when the updater starts checking for an update.
  • "update-not-available": Logs when no updates are available after a check and notifies the user.
  • "download-progress": Logs the progress of an ongoing download. This is particularly useful for debugging in development.

Configurations:

  • Enables pre-release versions to be considered in updates.
  • Disables automatic download of updates; requires manual trigger to download.
  • Optionally sets a development-specific configuration to force update checks without needing to package the app (commented out by default).

Returns

void

Defined in

src/electron/helpers/utils/update.ts:55 (opens in a new tab)


restartAndInstall

restartAndInstall(): void

Restarts the application and installs the downloaded update.

Returns

void

Defined in

src/electron/helpers/utils/update.ts:127 (opens in a new tab)