Difference between revisions of "Vortex API Events"
Pickysaurus (talk | contribs) m (→Events: Added remaining events) |
m (minor typo in params for did-deploy) |
||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{VortexVersion| 1.2.16}} | ||
This page will document all the events Vortex can send and receive using the Vortex API. | This page will document all the events Vortex can send and receive using the Vortex API. | ||
Line 21: | Line 22: | ||
== Events == | == Events == | ||
− | + | '''Mods Enabled''' | |
+ | |||
Emitted by Vortex when one or more mods are enabled. | Emitted by Vortex when one or more mods are enabled. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 39: | Line 41: | ||
|} | |} | ||
− | + | '''Game Mode Activated''' | |
+ | |||
Emitted by Vortex when switching the currently managed game, including when the application first starts. | Emitted by Vortex when switching the currently managed game, including when the application first starts. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 61: | Line 64: | ||
|} | |} | ||
− | + | '''Startup''' | |
− | Emitted by Vortex when the application first starts. | + | |
+ | Emitted by Vortex when the application first starts (after the extensions are loaded by before the UI is displayed). | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
| style="width:10%" | Name | | style="width:10%" | Name | ||
Line 79: | Line 83: | ||
|} | |} | ||
− | + | '''Will Deploy''' | |
+ | |||
Emitted asynchronously by Vortex before starting a deployment. | Emitted asynchronously by Vortex before starting a deployment. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 99: | Line 104: | ||
|} | |} | ||
− | + | '''Did Deploy''' | |
+ | |||
Emitted asynchronously by Vortex after finishing a deployment. | Emitted asynchronously by Vortex after finishing a deployment. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 111: | Line 117: | ||
|<pre> | |<pre> | ||
context.api.onAsync('did-deploy', | context.api.onAsync('did-deploy', | ||
− | ( | + | (profileId, newDeployment) => console.log(`Finished deploying mods for profile ${profileId}`) |
); | ); | ||
Line 119: | Line 125: | ||
|} | |} | ||
− | + | '''Profile Will Change''' | |
+ | |||
Emitted by Vortex before switching between profiles. | Emitted by Vortex before switching between profiles. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 139: | Line 146: | ||
* The events <code>profile-will-change</code> and <code>profile-did-change</code> also fire when swapping between games, because each game has a separate profile. | * The events <code>profile-will-change</code> and <code>profile-did-change</code> also fire when swapping between games, because each game has a separate profile. | ||
* The newProfileId property can be undefined if the user deletes the last profile for their active game. | * The newProfileId property can be undefined if the user deletes the last profile for their active game. | ||
+ | * The enqueue function can be used to return a Promise which needs to be fulfilled before the profile may be changed. The change can not be cancelled though because we can't know if/how previous changes can be rolled back. | ||
|- | |- | ||
|} | |} | ||
− | + | '''Profile Did Change''' | |
+ | |||
Emitted by Vortex after switching between profiles. | Emitted by Vortex after switching between profiles. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 165: | Line 174: | ||
|} | |} | ||
− | + | '''Did Import Downloads''' | |
+ | |||
Emitted by Vortex after adding new downloads to the downloads section. | Emitted by Vortex after adding new downloads to the downloads section. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 183: | Line 193: | ||
|} | |} | ||
− | + | '''Will Move Downloads''' | |
+ | |||
Emitted by Vortex before the user relocates their download folder for a game. | Emitted by Vortex before the user relocates their download folder for a game. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 201: | Line 212: | ||
|} | |} | ||
− | + | '''Filehash Calculated''' | |
+ | |||
Emitted by Vortex after the user adds a new file and its MD5 has been calculated. | Emitted by Vortex after the user adds a new file and its MD5 has been calculated. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 219: | Line 231: | ||
|} | |} | ||
− | + | '''Added Files''' | |
+ | |||
Emitted asynchronously by Vortex if new files have been created in the mods folder and Vortex has attempted to identify where they came from. | Emitted asynchronously by Vortex if new files have been created in the mods folder and Vortex has attempted to identify where they came from. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 240: | Line 253: | ||
|} | |} | ||
− | + | '''Mod Enabled''' | |
+ | |||
Emitted by Vortex when a mod is toggled from disabled to enabled. | Emitted by Vortex when a mod is toggled from disabled to enabled. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 257: | Line 271: | ||
|} | |} | ||
− | + | '''Mod Disabled''' | |
+ | |||
Emitted by Vortex when a mod is toggled from enabled to disabled. | Emitted by Vortex when a mod is toggled from enabled to disabled. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 274: | Line 289: | ||
|} | |} | ||
− | + | '''Mod Content Changed''' | |
+ | |||
Emitted when Vortex determines the files inside a mod were changed (files might have been deleted or added). Primarily useful to update caches. | Emitted when Vortex determines the files inside a mod were changed (files might have been deleted or added). Primarily useful to update caches. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 291: | Line 307: | ||
|} | |} | ||
− | + | '''Will Purge''' | |
+ | |||
Emitted by Vortex before purging deployed mods. | Emitted by Vortex before purging deployed mods. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 308: | Line 325: | ||
|} | |} | ||
− | + | '''Did Purge''' | |
+ | |||
Emitted by Vortex after purging deployed mods. | Emitted by Vortex after purging deployed mods. | ||
{| class="wikitable" style="width:80%" | {| class="wikitable" style="width:80%" | ||
Line 326: | Line 344: | ||
== Commands == | == Commands == | ||
+ | '''Start Download URL''' | ||
+ | |||
+ | Instruct Vortex to download the file at a given URL and name the resulting file. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | start-download-url | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(url: string, fileName: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('start-download-url', url, fileName); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Show Balloon''' | ||
+ | |||
+ | Instruct Vortex to display a notification to the user. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | show-balloon | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(title: string, content: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('show-balloon', title, content); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Deploy Mods''' | ||
+ | |||
+ | Instruct Vortex to deploy all mods for the active profile. This is an asynchronous function. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | deploy-mods | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(callback: (err: Error) => void, profileId?: string, progressCB?: (text: string, percent: number) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('deploy-mods', (err) => console.warn(`Error deploying mods \n${err}` ); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Deploy Single Mod''' | ||
+ | |||
+ | Instruct Vortex to asynchronously deploy all files from a single mod, ignoring file conflicts. This command should only be used in very specific cases. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | deploy-single-mod | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, modId: string, enable?: boolean)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.emitAndAwait('deploy-single-mod', gameId, modId, enable); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Purge Mods In Path''' | ||
+ | |||
+ | Instruct Vortex to asynchronously purge a specific mod type, overriding the deployment target. This is intended to be used to clean up when an upgrade to a game extension changed the way mods get deployed such that the deployment target the new version would dynamically generate doesn't match where the old version deployed to. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | purge-mods-in-path | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, modType: string, modPath: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.emitAndAwait('purge-mods-in-path', gameId, modType, modPath); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Purge Mods''' | ||
+ | |||
+ | Intruct Vortex to purge the currently deployed mods. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | purge-mods | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(allowFallback: boolean, callback: (err: Error) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('purge-mods', allowFallback, (err) => console.warn(`Purge mods error \n ${err}`)); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Start Install''' | ||
+ | |||
+ | Intruct Vortex to start installing an archive as a mod. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | start-install | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(archivePath: string, callback: (err: Error, modId: string) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('start-install', archivePath, | ||
+ | (err, modId) => console.log(`Created Mod ${modId} from archive at ${archivePath}`) | ||
+ | ); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Start Install Download''' | ||
+ | |||
+ | Intruct Vortex to start installing a file that has been downloaded through Vortex. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | start-install-download | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(downloadId: string, allowAutoEnable: boolean, callback: (err: Error, modId: string) => void, forceInstaller: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('start-install-download', downloadId, allowAutoEnable, | ||
+ | (err, modId) => console.log(`Created Mod ${modId} from download Id ${downloadId}`) | ||
+ | ); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Remove Mod''' | ||
+ | |||
+ | Intruct Vortex to delete a mod. This is not reversible. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | remove-mod | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameMode: string, modId: string, callback: (err: Error) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('remove-mod', gameMode, modId, (err) => console.log(`Mod deleted $(modId)`)); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Create Mod''' | ||
+ | |||
+ | Intruct Vortex to create a new, empty mod. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | create-mod | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameMode: string, mod: IMod, callback: (err: Error) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('create-mod', gameMode, mod, (err) => console.log('Created a new mod'); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Update Categories''' | ||
+ | |||
+ | Intruct Vortex to make changes to the categories for a game, optionally completely overwriting them. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | update-categories | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, categories: { [id: string]: ICategory }, isUpdate: boolean)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('update-categories', gameId, categories, isUpdate); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Activate Game''' | ||
+ | |||
+ | Intruct Vortex to switch the currently managed game. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | activate-game | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('activate-game', gameId); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Check Mods Version''' | ||
+ | |||
+ | Intruct Vortex to check for updates on the specified mods. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | activate-game | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, mods: { [id: string]: IMod }, forceFull: boolean)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('check-mods-version', gameId, mods, forceFull); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Notes | ||
+ | | | ||
+ | * If forceFull is false (or undefined) Vortex may use cached data for this update check. This is to prevent using more requests than necessary. | ||
+ | |- | ||
+ | |} | ||
+ | '''Nexus Download''' | ||
+ | |||
+ | Intruct Vortex to asynchronously download a file from Nexus Mods. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | nexus-download | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, modId: string, fileId: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.emitAndAwait('nexus-download', gameId, modId, fileId); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Endorse Nexus Mod''' | ||
+ | |||
+ | Intruct Vortex to asynchronously send an endorsement to Nexus Mods. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | endorse-nexus-mod | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, nexusModId: number, version: string, endorsedStatus: EndorsedStatus)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.emitAndAwait('endorse-nexus-mod', gameId, nexusModId, version, endorsedStatus); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Endorse Mod''' | ||
+ | |||
+ | Intruct Vortex to toggle the endorsement status of a mod locally. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | endorse-mod | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, modId: string, endorsedStatus: EndorsedStatus)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('endorse-mod', gameId, modId, endorsedStatus); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Submit Feedback''' | ||
+ | |||
+ | Intruct Vortex to toggle the send feedback to the Nexus Mods team. It is unlikely this will need to be used by a user extension. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | submit-feedback | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(title: string, message: string, hash: string, feedbackFiles: string[], anonymous: boolean, callback: (err: Error, response?: IFeedbackResponse) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('submit-feedback', title, message, hash, feedbackFiles, anonymous, | ||
+ | (err, response) => console.log('Feedback response', response) | ||
+ | ); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Mod Update''' | ||
+ | |||
+ | Intruct Vortex to update a mod which is showing an update pending. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | mod-update | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, modId: string, fileId: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('mod-update', gameId, modId, fileId); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Open Mod Page''' | ||
+ | |||
+ | Intruct Vortex to update the listed download page for the selected mod. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | open-mod-page | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(gameId: string, modId: string, source: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('open-mod-page', gameId, modId, source); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Notes | ||
+ | | | ||
+ | * If the mod is not from Nexus Mods, your extension will need to handle these events. | ||
+ | |- | ||
+ | |} | ||
+ | '''Enable Download Watch''' | ||
+ | |||
+ | Intruct Vortex to start or stop watching the downloads folder for newly added files. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | enable-download-watch | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(enabled: boolean)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('enable-download-watch', enabled); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Notes | ||
+ | | | ||
+ | * When importing mods, if you intend to create database entries for the archives yourself, it may make sense to disable this but make sure to re-enable afterwards and to have a modal dialog to prevent the user from manually adding files while this is disabled. | ||
+ | |- | ||
+ | |} | ||
+ | '''Autosort Plugins''' | ||
+ | |||
+ | Intruct Vortex to run the autosort operation for an active Gamebyro game. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | autosort-plugins | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(manual: boolean, callback: (err: Error) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('autosort-plugins', manual, (err) => console.log('Autosorting')); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Show Main Page''' | ||
+ | |||
+ | Intruct Vortex to display the specified page of the app (e.g. Mods, Downloads, Settings). | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | show-main-page | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(pageId: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('show-main-page', pageId); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Notes | ||
+ | | | ||
+ | * To show a custom page you'll first need to register it. | ||
+ | |- | ||
+ | |} | ||
+ | '''Show Modal''' | ||
+ | |||
+ | Intruct Vortex to display the specified modal box. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | show-modal | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(id: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('show-modal', id); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Notes | ||
+ | | | ||
+ | * To show a custom modal you'll first need to register it. | ||
+ | |- | ||
+ | |} | ||
+ | '''Import Downloads''' | ||
+ | |||
+ | Intruct Vortex to copy the listed files into your active downloads directory. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | import-downloads | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(downloadPaths: string[])</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('import-downloads', downloadPaths); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Remove Download''' | ||
+ | |||
+ | Intruct Vortex to delete a download from your active downloads directory. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | remove-download | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(downloadId: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('remove-download', downloadId); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Pause Download''' | ||
+ | |||
+ | Intruct Vortex to pause an active download. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | pause-download | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(downloadId: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('pause-download', downloadId); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Resume Download''' | ||
+ | |||
+ | Intruct Vortex to resume a paused download. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | resume-download | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(downloadId: string, callback: (err: Error, id: string) => void)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('resume-download', downloaded (err, id) => console.log(`Resumed download ${id}`)); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Start Download''' | ||
+ | |||
+ | Intruct Vortex to start a download from the internet to your active downloads directory. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | start-download | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(urls: string[], modInfo: any, fileName: string, callback: (err: Error, id: string) => void, redownload: RedownloadMode)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('start-download', urls, modInfo, fileName, | ||
+ | (err, id) => console.log('Starting download', id), redownload | ||
+ | ); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Notes | ||
+ | | | ||
+ | * Multiple URLs can be specified to download from multiple sources or to have a fallback if one doesn't work, however this currently has no effect. | ||
+ | |- | ||
+ | |} | ||
+ | '''Quick Launch''' | ||
+ | |||
+ | Intruct Vortex to run the primary executable/tool for the active game. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | quick-launch | ||
+ | |- | ||
+ | | Parameters | ||
+ | |''none'' | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('quick-launch'); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Trigger Test Run''' | ||
+ | |||
+ | Intruct Vortex to start run validity checks that find problems with the setup of Vortex or the game. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | trigger-test-run | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(eventType: string, delay: number)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.events.emit('trigger-test-run', eventType, delay); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Notes | ||
+ | | | ||
+ | * If you would like to include your own tests, you will first need to register them. | ||
+ | |- | ||
+ | |} | ||
+ | '''Install Extension''' | ||
+ | |||
+ | Intruct Vortex to asynchronously install an extension. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | install-extension | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(extensionInfo: IExtensionDownloadInfo)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.emitAndWait('install-extension', extensionInfo); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Browse For Download''' | ||
+ | |||
+ | Intruct Vortex to open the built-in web browser to a specified page, then exit once a file download is started. You may also add instructions that will appear above the browser window. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | browse-for-download | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(url: string, instructions: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.emitAndWait('browse-for-download', url, instructions); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
+ | '''Open Knowledge Base''' | ||
+ | |||
+ | Intruct Vortex to open the Knowledge Base tab to a specified wiki page. | ||
+ | {| class="wikitable" style="width:80%" | ||
+ | | style="width:10%" | Name | ||
+ | | open-knowledge-base | ||
+ | |- | ||
+ | | Parameters | ||
+ | |<code>(wikiId: string)</code> | ||
+ | |- | ||
+ | | Example | ||
+ | |<pre> | ||
+ | context.api.emitAndWait('open-knowledge-base', wikiId); | ||
+ | </pre> | ||
+ | |- | ||
+ | |} | ||
== Internal Events == | == Internal Events == | ||
+ | As these events are not intended to be used by 3rd party developers (and can easily be misused) they are not fully documented here. | ||
+ | |||
+ | * report-feedback | ||
+ | * report-log-error | ||
+ | * start-quick-discovery | ||
+ | * start-discovery | ||
+ | * cancel-discovery | ||
+ | * await-activation | ||
+ | * quickbms-operation | ||
+ | * set-plugin-list | ||
+ | * select-theme | ||
+ | * show-modal | ||
+ | * refresh-main-page | ||
+ | * did-update-masterlist | ||
+ | * apply-settings | ||
+ | * edit-mod-cycle | ||
+ | * force-unblock-elevating | ||
+ | * manually-set-game-location | ||
+ | * retrieve-category-list | ||
+ | * request-nexus-login | ||
+ | * request-own-issues | ||
+ | * bake-settings | ||
+ | * refresh-game-info | ||
+ | * refresh-downloads | ||
+ | * plugin-details | ||
[[Category: Vortex]] | [[Category: Vortex]] | ||
[[Category: Development]] | [[Category: Development]] |
Latest revision as of 15:41, 9 July 2020
This content applies to Vortex 1.2.16. |
This page will document all the events Vortex can send and receive using the Vortex API.
Interacting with events
You can both catch and emit all events inside Vortex. The Vortex API is accessed as a property of the context
object.
In order to have your extension respond to an event you can use the following:
context.api.events.on('eventName', callback); context.api.onAsync('eventName', callback);
To emit an event (or command) yourself use the following:
context.api.events.emit('eventName', callback); context.api.emitAndAwait('eventName', callback);
Notice that the asynchronous version is called from the API object directly, rather than from the events property.
Events
Mods Enabled
Emitted by Vortex when one or more mods are enabled.
Name | mods-enabled |
Parameters | (mods: string[], enabled: boolean, gameId: string)
|
Example | context.api.events.on('mods-enabled', (mods, enabled, gameId) => console.log(`${mods.count} mods ${enabled ? 'enabled' : 'disabled'} in ${gameId}`) ); |
Game Mode Activated
Emitted by Vortex when switching the currently managed game, including when the application first starts.
Name | gamemode-activated |
Parameters | (gameId: string)
|
Example | context.api.events.on('gamemode-activated', (gameId) => console.log(`Activated game mode in ${gameId}`) ); |
Notes |
|
Startup
Emitted by Vortex when the application first starts (after the extensions are loaded by before the UI is displayed).
Name | startup |
Parameters | none |
Example | context.api.events.on('startup', () => console.log('Vortex is starting up.') ); |
Will Deploy
Emitted asynchronously by Vortex before starting a deployment.
Name | will-deploy |
Parameters | (profileId: string, oldDeployment: { [modType: string]: IDeployedFile[] })
|
Example | context.api.onAsync('will-deploy', (profiled, oldDeployment) => console.log(`About to deploy mods for profile ${profileId}`) ); context.api.emitAndAwait('will-deploy', profileId, lastDeployment); |
Did Deploy
Emitted asynchronously by Vortex after finishing a deployment.
Name | did-deploy |
Parameters | (profileId: string, newDeployment: { [modType: string]: IDeployedFile[] })
|
Example | context.api.onAsync('did-deploy', (profileId, newDeployment) => console.log(`Finished deploying mods for profile ${profileId}`) ); context.api.emitAndAwait('did-deploy', profileId, thisDeployment); |
Profile Will Change
Emitted by Vortex before switching between profiles.
Name | profile-will-change |
Parameters | (newProfileId: string, enqueue: (cb: () => Promise<void>) => void)
|
Example | context.api.events.on('profile-will-change', (newProfileId, enqueue: () => undefined) => console.log(`Preparing to switch to profile ${newProfileId}`) ); |
Notes |
|
Profile Did Change
Emitted by Vortex after switching between profiles.
Name | profile-did-change |
Parameters | (newProfileId: string)
|
Example | context.api.events.on('profile-did-change', (newProfileId => console.log(`Finished switching to profile ${newProfileId}`) ); |
Notes |
|
Did Import Downloads
Emitted by Vortex after adding new downloads to the downloads section.
Name | did-import-downloads |
Parameters | (dlIds: string[])
|
Example | context.api.events.on('did-import-downloads', (dlIds => console.log(`Imported ${dlIds.length} downloads`) ); |
Will Move Downloads
Emitted by Vortex before the user relocates their download folder for a game.
Name | will-move-downloads |
Parameters | none |
Example | context.api.events.on('profile-did-change', (() => console.log('Vortex is preparing to move downloads.') ); |
Filehash Calculated
Emitted by Vortex after the user adds a new file and its MD5 has been calculated.
Name | filehash-calculated |
Parameters | (filePath: string, fileMD5: string, fileSize: number)
|
Example | context.api.events.on('filehash-calculated', (filePath, fileMD5, fileSize) => console.log(`File at ${filePath} is ${fileSize} bytes with MD5 of ${fileMD5}`) ); |
Added Files
Emitted asynchronously by Vortex if new files have been created in the mods folder and Vortex has attempted to identify where they came from.
Name | added-files |
Parameters | (profileId: string, newFiles: Array<{ filePath: string, candidates: string[] }>)
|
Example | context.api.onAsync('added-files', (profileId, newFiles) => { const fileInfo = newFiles.map(f => `File${f.filePath} could be a part of the following mods ${f.candidates.join('\n')}`).join('\n'); console.log(`New files detected in the mods folder for ${profileId}\n${fileInfo}`); }) ); |
Mod Enabled
Emitted by Vortex when a mod is toggled from disabled to enabled.
Name | mod-enabled |
Parameters | (profileId: string, modId: string)
|
Example | context.api.events.on('mod-enabled', (profileId, modId) => console.log(`Mod ${modId} enabled in ${profileId}`) ); |
Mod Disabled
Emitted by Vortex when a mod is toggled from enabled to disabled.
Name | mod-disabled |
Parameters | (profileId: string, modId: string)
|
Example | context.api.events.on('mod-disabled', (profileId, modId) => console.log(`Mod ${modId} disabled in ${profileId}`) ); |
Mod Content Changed
Emitted when Vortex determines the files inside a mod were changed (files might have been deleted or added). Primarily useful to update caches.
Name | mod-content-changed |
Parameters | (profileId: string, modId: string)
|
Example | context.api.events.on('mod-content-changed', (profileId, modId) => console.log(`Mod ${modId} in ${profileId} changed`) ); |
Will Purge
Emitted by Vortex before purging deployed mods.
Name | will-purge |
Parameters | (profileId: string, deployment: IDeployment)
|
Example | context.api.events.on('will-purge', (profileId, deployment) => console.log(`Preparing to purge on profile ${profileId}`) ); |
Did Purge
Emitted by Vortex after purging deployed mods.
Name | did-purge |
Parameters | (profileId: string)
|
Example | context.api.events.on('did-purge', (profileId) => console.log(`Finished purge on profile ${profileId}`) ); |
Commands
Start Download URL
Instruct Vortex to download the file at a given URL and name the resulting file.
Name | start-download-url |
Parameters | (url: string, fileName: string)
|
Example | context.api.events.emit('start-download-url', url, fileName); |
Show Balloon
Instruct Vortex to display a notification to the user.
Name | show-balloon |
Parameters | (title: string, content: string)
|
Example | context.api.events.emit('show-balloon', title, content); |
Deploy Mods
Instruct Vortex to deploy all mods for the active profile. This is an asynchronous function.
Name | deploy-mods |
Parameters | (callback: (err: Error) => void, profileId?: string, progressCB?: (text: string, percent: number) => void)
|
Example | context.api.events.emit('deploy-mods', (err) => console.warn(`Error deploying mods \n${err}` ); |
Deploy Single Mod
Instruct Vortex to asynchronously deploy all files from a single mod, ignoring file conflicts. This command should only be used in very specific cases.
Name | deploy-single-mod |
Parameters | (gameId: string, modId: string, enable?: boolean)
|
Example | context.api.emitAndAwait('deploy-single-mod', gameId, modId, enable); |
Purge Mods In Path
Instruct Vortex to asynchronously purge a specific mod type, overriding the deployment target. This is intended to be used to clean up when an upgrade to a game extension changed the way mods get deployed such that the deployment target the new version would dynamically generate doesn't match where the old version deployed to.
Name | purge-mods-in-path |
Parameters | (gameId: string, modType: string, modPath: string)
|
Example | context.api.emitAndAwait('purge-mods-in-path', gameId, modType, modPath); |
Purge Mods
Intruct Vortex to purge the currently deployed mods.
Name | purge-mods |
Parameters | (allowFallback: boolean, callback: (err: Error) => void)
|
Example | context.api.events.emit('purge-mods', allowFallback, (err) => console.warn(`Purge mods error \n ${err}`)); |
Start Install
Intruct Vortex to start installing an archive as a mod.
Name | start-install |
Parameters | (archivePath: string, callback: (err: Error, modId: string) => void)
|
Example | context.api.events.emit('start-install', archivePath, (err, modId) => console.log(`Created Mod ${modId} from archive at ${archivePath}`) ); |
Start Install Download
Intruct Vortex to start installing a file that has been downloaded through Vortex.
Name | start-install-download |
Parameters | (downloadId: string, allowAutoEnable: boolean, callback: (err: Error, modId: string) => void, forceInstaller: string)
|
Example | context.api.events.emit('start-install-download', downloadId, allowAutoEnable, (err, modId) => console.log(`Created Mod ${modId} from download Id ${downloadId}`) ); |
Remove Mod
Intruct Vortex to delete a mod. This is not reversible.
Name | remove-mod |
Parameters | (gameMode: string, modId: string, callback: (err: Error) => void)
|
Example | context.api.events.emit('remove-mod', gameMode, modId, (err) => console.log(`Mod deleted $(modId)`)); |
Create Mod
Intruct Vortex to create a new, empty mod.
Name | create-mod |
Parameters | (gameMode: string, mod: IMod, callback: (err: Error) => void)
|
Example | context.api.events.emit('create-mod', gameMode, mod, (err) => console.log('Created a new mod'); |
Update Categories
Intruct Vortex to make changes to the categories for a game, optionally completely overwriting them.
Name | update-categories |
Parameters | (gameId: string, categories: { [id: string]: ICategory }, isUpdate: boolean)
|
Example | context.api.events.emit('update-categories', gameId, categories, isUpdate); |
Activate Game
Intruct Vortex to switch the currently managed game.
Name | activate-game |
Parameters | (gameId: string)
|
Example | context.api.events.emit('activate-game', gameId); |
Check Mods Version
Intruct Vortex to check for updates on the specified mods.
Name | activate-game |
Parameters | (gameId: string, mods: { [id: string]: IMod }, forceFull: boolean)
|
Example | context.api.events.emit('check-mods-version', gameId, mods, forceFull); |
Notes |
|
Nexus Download
Intruct Vortex to asynchronously download a file from Nexus Mods.
Name | nexus-download |
Parameters | (gameId: string, modId: string, fileId: string)
|
Example | context.api.emitAndAwait('nexus-download', gameId, modId, fileId); |
Endorse Nexus Mod
Intruct Vortex to asynchronously send an endorsement to Nexus Mods.
Name | endorse-nexus-mod |
Parameters | (gameId: string, nexusModId: number, version: string, endorsedStatus: EndorsedStatus)
|
Example | context.api.emitAndAwait('endorse-nexus-mod', gameId, nexusModId, version, endorsedStatus); |
Endorse Mod
Intruct Vortex to toggle the endorsement status of a mod locally.
Name | endorse-mod |
Parameters | (gameId: string, modId: string, endorsedStatus: EndorsedStatus)
|
Example | context.api.events.emit('endorse-mod', gameId, modId, endorsedStatus); |
Submit Feedback
Intruct Vortex to toggle the send feedback to the Nexus Mods team. It is unlikely this will need to be used by a user extension.
Name | submit-feedback |
Parameters | (title: string, message: string, hash: string, feedbackFiles: string[], anonymous: boolean, callback: (err: Error, response?: IFeedbackResponse) => void)
|
Example | context.api.events.emit('submit-feedback', title, message, hash, feedbackFiles, anonymous, (err, response) => console.log('Feedback response', response) ); |
Mod Update
Intruct Vortex to update a mod which is showing an update pending.
Name | mod-update |
Parameters | (gameId: string, modId: string, fileId: string)
|
Example | context.api.events.emit('mod-update', gameId, modId, fileId); |
Open Mod Page
Intruct Vortex to update the listed download page for the selected mod.
Name | open-mod-page |
Parameters | (gameId: string, modId: string, source: string)
|
Example | context.api.events.emit('open-mod-page', gameId, modId, source); |
Notes |
|
Enable Download Watch
Intruct Vortex to start or stop watching the downloads folder for newly added files.
Name | enable-download-watch |
Parameters | (enabled: boolean)
|
Example | context.api.events.emit('enable-download-watch', enabled); |
Notes |
|
Autosort Plugins
Intruct Vortex to run the autosort operation for an active Gamebyro game.
Name | autosort-plugins |
Parameters | (manual: boolean, callback: (err: Error) => void)
|
Example | context.api.events.emit('autosort-plugins', manual, (err) => console.log('Autosorting')); |
Show Main Page
Intruct Vortex to display the specified page of the app (e.g. Mods, Downloads, Settings).
Name | show-main-page |
Parameters | (pageId: string)
|
Example | context.api.events.emit('show-main-page', pageId); |
Notes |
|
Show Modal
Intruct Vortex to display the specified modal box.
Name | show-modal |
Parameters | (id: string)
|
Example | context.api.events.emit('show-modal', id); |
Notes |
|
Import Downloads
Intruct Vortex to copy the listed files into your active downloads directory.
Name | import-downloads |
Parameters | (downloadPaths: string[])
|
Example | context.api.events.emit('import-downloads', downloadPaths); |
Remove Download
Intruct Vortex to delete a download from your active downloads directory.
Name | remove-download |
Parameters | (downloadId: string)
|
Example | context.api.events.emit('remove-download', downloadId); |
Pause Download
Intruct Vortex to pause an active download.
Name | pause-download |
Parameters | (downloadId: string)
|
Example | context.api.events.emit('pause-download', downloadId); |
Resume Download
Intruct Vortex to resume a paused download.
Name | resume-download |
Parameters | (downloadId: string, callback: (err: Error, id: string) => void)
|
Example | context.api.events.emit('resume-download', downloaded (err, id) => console.log(`Resumed download ${id}`)); |
Start Download
Intruct Vortex to start a download from the internet to your active downloads directory.
Name | start-download |
Parameters | (urls: string[], modInfo: any, fileName: string, callback: (err: Error, id: string) => void, redownload: RedownloadMode)
|
Example | context.api.events.emit('start-download', urls, modInfo, fileName, (err, id) => console.log('Starting download', id), redownload ); |
Notes |
|
Quick Launch
Intruct Vortex to run the primary executable/tool for the active game.
Name | quick-launch |
Parameters | none |
Example | context.api.events.emit('quick-launch'); |
Trigger Test Run
Intruct Vortex to start run validity checks that find problems with the setup of Vortex or the game.
Name | trigger-test-run |
Parameters | (eventType: string, delay: number)
|
Example | context.api.events.emit('trigger-test-run', eventType, delay); |
Notes |
|
Install Extension
Intruct Vortex to asynchronously install an extension.
Name | install-extension |
Parameters | (extensionInfo: IExtensionDownloadInfo)
|
Example | context.api.emitAndWait('install-extension', extensionInfo); |
Browse For Download
Intruct Vortex to open the built-in web browser to a specified page, then exit once a file download is started. You may also add instructions that will appear above the browser window.
Name | browse-for-download |
Parameters | (url: string, instructions: string)
|
Example | context.api.emitAndWait('browse-for-download', url, instructions); |
Open Knowledge Base
Intruct Vortex to open the Knowledge Base tab to a specified wiki page.
Name | open-knowledge-base |
Parameters | (wikiId: string)
|
Example | context.api.emitAndWait('open-knowledge-base', wikiId); |
Internal Events
As these events are not intended to be used by 3rd party developers (and can easily be misused) they are not fully documented here.
- report-feedback
- report-log-error
- start-quick-discovery
- start-discovery
- cancel-discovery
- await-activation
- quickbms-operation
- set-plugin-list
- select-theme
- show-modal
- refresh-main-page
- did-update-masterlist
- apply-settings
- edit-mod-cycle
- force-unblock-elevating
- manually-set-game-location
- retrieve-category-list
- request-nexus-login
- request-own-issues
- bake-settings
- refresh-game-info
- refresh-downloads
- plugin-details