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
-
↳
UpdateManager
Constructors
constructor
• new UpdateManager(): UpdateManager
Returns
Inherited from
Properties
private
• Private
#private: any
Inherited from
Defined in
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
Name | Type |
---|---|
toApply | VelopackAsset |
Returns
void
Inherited from
UpdateManagerSync.applyUpdatesAndExit
Defined in
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
Name | Type |
---|---|
toApply | VelopackAsset |
restartArgs? | readonly string [] |
Returns
void
Inherited from
UpdateManagerSync.applyUpdatesAndRestart
Defined in
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
Inherited from
UpdateManagerSync.checkForUpdates
Defined in
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
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
Name | Type |
---|---|
toDownload | VelopackAsset |
Returns
void
Inherited from
UpdateManagerSync.downloadUpdates
Defined in
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
Name | Type |
---|---|
toDownload | VelopackAsset |
progress | (arg : number ) => void |
Returns
Promise
<void
>
Defined in
getCheckForUpdatesCommand
▸ getCheckForUpdatesCommand(): string
[]
Returns the command line arguments to check for updates.
Returns
string
[]
Inherited from
UpdateManagerSync.getCheckForUpdatesCommand
Defined in
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
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
getCurrentVersionCommand
▸ getCurrentVersionCommand(): string
[]
Returns the command line arguments to get the current version of the application.
Returns
string
[]
Inherited from
UpdateManagerSync.getCurrentVersionCommand
Defined in
getDownloadUpdatesCommand
▸ getDownloadUpdatesCommand(toDownload
): string
[]
Returns the command line arguments to download the specified update.
Parameters
Name | Type |
---|---|
toDownload | VelopackAsset |
Returns
string
[]
Inherited from
UpdateManagerSync.getDownloadUpdatesCommand
Defined in
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
getUpdateApplyCommand
▸ getUpdateApplyCommand(toApply
, silent
, restart
, wait
, restartArgs?
): string
[]
Returns the command line arguments to apply the specified update.
Parameters
Name | Type |
---|---|
toApply | VelopackAsset |
silent | boolean |
restart | boolean |
wait | boolean |
restartArgs? | readonly string [] |
Returns
string
[]
Inherited from
UpdateManagerSync.getUpdateApplyCommand
Defined in
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
Defined in
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
Name | Type |
---|---|
allowDowngrade | boolean |
Returns
void
Inherited from
UpdateManagerSync.setAllowDowngrade
Defined in
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
Name | Type |
---|---|
explicitChannel | string |
Returns
void
Inherited from
UpdateManagerSync.setExplicitChannel
Defined in
setUrlOrPath
▸ setUrlOrPath(urlOrPath
): void
Set the URL or local file path to the update server. This is required before calling CheckForUpdates or DownloadUpdates.
Parameters
Name | Type |
---|---|
urlOrPath | string |
Returns
void
Inherited from
UpdateManagerSync.setUrlOrPath
Defined in
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
Name | Type |
---|---|
toApply | VelopackAsset |
silent | boolean |
restart | boolean |
restartArgs? | readonly string [] |
Returns
void
Inherited from
UpdateManagerSync.waitExitThenApplyUpdates