VelopackApp class
VelopackApp helps you to handle app activation events correctly. This should be used as early as possible in your application startup code. (eg. the beginning of main() or wherever your entry point is)
class VelopackApp
Constructors
| Constructor | Summary |
|---|---|
constructor |
constructor()
constructor()
Methods
| Method | Summary |
|---|---|
onAfterInstallFastCallback | WARNING: FastCallback hooks are run during critical stages of Velopack operations. |
onAfterUpdateFastCallback | WARNING: FastCallback hooks are run during critical stages of Velopack operations. |
onBeforeUninstallFastCallback | WARNING: FastCallback hooks are run during critical stages of Velopack operations. |
onBeforeUpdateFastCallback | WARNING: FastCallback hooks are run during critical stages of Velopack operations. |
onFirstRun | This hook is triggered when the application is started for the first time after installation. |
onRestarted | This hook is triggered when the application is restarted by Velopack after installing updates. |
run | Runs the Velopack startup logic. This should be the first thing to run in your app. |
setArgs | Override the command line arguments used by VelopackApp. (by default this is env::args().skip(1)) |
setAutoApplyOnStartup | Set whether to automatically apply downloaded updates on startup. This is ON by default. |
setLocator | VelopackLocator provides some utility functions for locating the current app important paths (eg. path to packages, update binary, and so forth). |
setLogger | Set a callback to receive log messages from VelopackApp. |
build | Build a new VelopackApp instance. |
onAfterInstallFastCallback(callback)
onAfterInstallFastCallback(callback: VelopackHook): VelopackApp
WARNING: FastCallback hooks are run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Type | Description |
|---|---|---|
callback | VelopackHook |
Returns VelopackApp
onAfterUpdateFastCallback(callback)
onAfterUpdateFastCallback(callback: VelopackHook): VelopackApp
WARNING: FastCallback hooks are run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 15 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Type | Description |
|---|---|---|
callback | VelopackHook |
Returns VelopackApp
onBeforeUninstallFastCallback(callback)
onBeforeUninstallFastCallback(callback: VelopackHook): VelopackApp
WARNING: FastCallback hooks are run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Type | Description |
|---|---|---|
callback | VelopackHook |
Returns VelopackApp
onBeforeUpdateFastCallback(callback)
onBeforeUpdateFastCallback(callback: VelopackHook): VelopackApp
WARNING: FastCallback hooks are run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 15 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Type | Description |
|---|---|---|
callback | VelopackHook |
Returns VelopackApp
onFirstRun(callback)
onFirstRun(callback: VelopackHook): VelopackApp
This hook is triggered when the application is started for the first time after installation.
Parameters
| Name | Type | Description |
|---|---|---|
callback | VelopackHook |
Returns VelopackApp
onRestarted(callback)
onRestarted(callback: VelopackHook): VelopackApp
This hook is triggered when the application is restarted by Velopack after installing updates.
Parameters
| Name | Type | Description |
|---|---|---|
callback | VelopackHook |
Returns VelopackApp
run()
run(): void
Runs the Velopack startup logic. This should be the first thing to run in your app. In some circumstances it may terminate/restart the process to perform tasks.
Returns void
setArgs(args)
setArgs(args: string[]): VelopackApp
Override the command line arguments used by VelopackApp. (by default this is env::args().skip(1))
Parameters
| Name | Type | Description |
|---|---|---|
args | string[] |
Returns VelopackApp
setAutoApplyOnStartup(autoApply)
setAutoApplyOnStartup(autoApply: boolean): VelopackApp
Set whether to automatically apply downloaded updates on startup. This is ON by default.
Parameters
| Name | Type | Description |
|---|---|---|
autoApply | boolean |
Returns VelopackApp
setLocator(locator)
setLocator(locator: VelopackLocatorConfig): VelopackApp
VelopackLocator provides some utility functions for locating the current app important paths (eg. path to packages, update binary, and so forth).
Parameters
| Name | Type | Description |
|---|---|---|
locator | VelopackLocatorConfig |
Returns VelopackApp
setLogger(callback)
setLogger(callback: object): VelopackApp
Set a callback to receive log messages from VelopackApp.
Parameters
| Name | Type | Description |
|---|---|---|
callback | object |
Returns VelopackApp
build()
build(): VelopackApp
static
Build a new VelopackApp instance.
Returns VelopackApp
Generated from velopack 1.1.1