Skip to main content

Class: UpdateManager

This class is used to check for updates, download updates, and apply updates. It provides the asynchronous functions of the UpdateManager class.

Hierarchy

Constructors

constructor

new UpdateManager(): UpdateManager

Returns

UpdateManager

Inherited from

UpdateManagerSync.constructor

Properties

#private

Private #private: any

Inherited from

UpdateManagerSync.#private

Defined in

Velopack.d.ts:130

Methods

applyUpdatesAndExit

applyUpdatesAndExit(toApply): void

This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified restart arguments. If you need to save state or clean up, you should do that before calling this method. The user may be prompted during the update, if the update requires additional frameworks to be installed etc.

Parameters

NameType
toApplyVelopackAsset

Returns

void

Inherited from

UpdateManagerSync.applyUpdatesAndExit

Defined in

Velopack.d.ts:199


applyUpdatesAndRestart

applyUpdatesAndRestart(toApply, restartArgs?): void

This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified restart arguments. If you need to save state or clean up, you should do that before calling this method. The user may be prompted during the update, if the update requires additional frameworks to be installed etc.

Parameters

NameType
toApplyVelopackAsset
restartArgs?readonly string[]

Returns

void

Inherited from

UpdateManagerSync.applyUpdatesAndRestart

Defined in

Velopack.d.ts:205


checkForUpdates

checkForUpdates(): UpdateInfo

This function will check for updates, and return information about the latest available release. This function runs synchronously and may take some time to complete, depending on the network speed and the number of updates available.

Returns

UpdateInfo

Inherited from

UpdateManagerSync.checkForUpdates

Defined in

Velopack.d.ts:186


checkForUpdatesAsync

checkForUpdatesAsync(): Promise<UpdateInfo>

This function will check for updates, and return information about the latest available release. This function runs synchronously and may take some time to complete, depending on the network speed and the number of updates available.

Returns

Promise<UpdateInfo>

Defined in

Velopack.d.ts:243


downloadUpdates

downloadUpdates(toDownload): void

Downloads the specified updates to the local app packages directory. If the update contains delta packages and ignoreDeltas=false, this method will attempt to unpack and prepare them. If there is no delta update available, or there is an error preparing delta packages, this method will fall back to downloading the full version of the update. This function will acquire a global update lock so may fail if there is already another update operation in progress.

Parameters

NameType
toDownloadVelopackAsset

Returns

void

Inherited from

UpdateManagerSync.downloadUpdates

Defined in

Velopack.d.ts:193


downloadUpdatesAsync

downloadUpdatesAsync(toDownload, progress): Promise<void>

Downloads the specified updates to the local app packages directory. If the update contains delta packages and ignoreDeltas=false, this method will attempt to unpack and prepare them. If there is no delta update available, or there is an error preparing delta packages, this method will fall back to downloading the full version of the update. This function will acquire a global update lock so may fail if there is already another update operation in progress.

Parameters

NameType
toDownloadVelopackAsset
progress(arg: number) => void

Returns

Promise<void>

Defined in

Velopack.d.ts:250


getCheckForUpdatesCommand

getCheckForUpdatesCommand(): string[]

Returns the command line arguments to check for updates.

Returns

string[]

Inherited from

UpdateManagerSync.getCheckForUpdatesCommand

Defined in

Velopack.d.ts:158


getCurrentVersion

getCurrentVersion(): string

Get the currently installed version of the application. If the application is not installed, this function will throw an exception.

Returns

string

Inherited from

UpdateManagerSync.getCurrentVersion

Defined in

Velopack.d.ts:180


getCurrentVersionAsync

getCurrentVersionAsync(): Promise<string>

Checks for updates, returning null if there are none available. If there are updates available, this method will return an UpdateInfo object containing the latest available release, and any delta updates that can be applied if they are available.

Returns

Promise<string>

Defined in

Velopack.d.ts:237


getCurrentVersionCommand

getCurrentVersionCommand(): string[]

Returns the command line arguments to get the current version of the application.

Returns

string[]

Inherited from

UpdateManagerSync.getCurrentVersionCommand

Defined in

Velopack.d.ts:154


getDownloadUpdatesCommand

getDownloadUpdatesCommand(toDownload): string[]

Returns the command line arguments to download the specified update.

Parameters

NameType
toDownloadVelopackAsset

Returns

string[]

Inherited from

UpdateManagerSync.getDownloadUpdatesCommand

Defined in

Velopack.d.ts:162


getPackagesDir

getPackagesDir(): string

Returns the path to the app's packages directory. This is where updates are downloaded to.

Returns

string

Inherited from

UpdateManagerSync.getPackagesDir

Defined in

Velopack.d.ts:170


getUpdateApplyCommand

getUpdateApplyCommand(toApply, silent, restart, wait, restartArgs?): string[]

Returns the command line arguments to apply the specified update.

Parameters

NameType
toApplyVelopackAsset
silentboolean
restartboolean
waitboolean
restartArgs?readonly string[]

Returns

string[]

Inherited from

UpdateManagerSync.getUpdateApplyCommand

Defined in

Velopack.d.ts:166


isInstalled

isInstalled(): boolean

Returns true if the current app is installed, false otherwise. If the app is not installed, other functions in UpdateManager may throw exceptions, so you may want to check this before calling other functions.

Returns

boolean

Inherited from

UpdateManagerSync.isInstalled

Defined in

Velopack.d.ts:175


setAllowDowngrade

setAllowDowngrade(allowDowngrade): void

Allows UpdateManager to update to a version that's lower than the current version (i.e. downgrading). This could happen if a release has bugs and was retracted from the release feed, or if you're using ExplicitChannel to switch channels to another channel where the latest version on that channel is lower than the current version.

Parameters

NameType
allowDowngradeboolean

Returns

void

Inherited from

UpdateManagerSync.setAllowDowngrade

Defined in

Velopack.d.ts:141


setExplicitChannel

setExplicitChannel(explicitChannel): void

This option should usually be left null. Overrides the default channel used to fetch updates. The default channel will be whatever channel was specified on the command line when building this release. For example, if the current release was packaged with '--channel beta', then the default channel will be 'beta'. This allows users to automatically receive updates from the same channel they installed from. This options allows you to explicitly switch channels, for example if the user wished to switch back to the 'stable' channel without having to reinstall the application.

Parameters

NameType
explicitChannelstring

Returns

void

Inherited from

UpdateManagerSync.setExplicitChannel

Defined in

Velopack.d.ts:150


setUrlOrPath

setUrlOrPath(urlOrPath): void

Set the URL or local file path to the update server. This is required before calling CheckForUpdates or DownloadUpdates.

Parameters

NameType
urlOrPathstring

Returns

void

Inherited from

UpdateManagerSync.setUrlOrPath

Defined in

Velopack.d.ts:134


waitExitThenApplyUpdates

waitExitThenApplyUpdates(toApply, silent, restart, restartArgs?): void

This will launch the Velopack updater and tell it to wait for this program to exit gracefully. You should then clean up any state and exit your app. The updater will apply updates and then optionally restart your app. The updater will only wait for 60 seconds before giving up.

Parameters

NameType
toApplyVelopackAsset
silentboolean
restartboolean
restartArgs?readonly string[]

Returns

void

Inherited from

UpdateManagerSync.waitExitThenApplyUpdates

Defined in

Velopack.d.ts:211