Gets the application version for the Electron main process.
Throws
If the Electron app module is not available or fetching the version fails.
Example
constversion = awaitgetAppVersionElectron();
Source
exportconstgetAppVersionElectron = async (): Promise<string> => { try { // Only import app in Electron main process if (typeofwindow === "undefined") { constelectron = awaitimport("electron"); returnelectron.app.getVersion(); } // Fallback for renderer process returngetAppVersion(); } catch { // Fallback if app is not available returnprocess.env.npm_package_version || "1.0.0"; } };
getAppVersionElectron():Promise<string>
Returns Promise<string>
A promise that resolves to the current application version as a string.
Gets the application version for the Electron main process.
Throws
If the Electron app module is not available or fetching the version fails.
Example
Source