export=
FitFileViewer - API Documentation v29.4.0
FitFileViewer - API Documentation / main / export=
Variable: export=
constexport=: {CONSTANTS:Readonly<{DEFAULT_THEME:"dark";DIALOG_FILTERS:Readonly<{ALL_FILES: readonly (Readonly<{extensions:string[];name:"FIT Files"; }> |Readonly<{extensions:string[];name:"All Files"; }>)[];EXPORT_FILES: readonly (Readonly<{extensions:string[];name:"CSV (Summary Table)"; }> |Readonly<{extensions:string[];name:"GPX (Track)"; }> |Readonly<{extensions:string[];name:"All Files"; }>)[];FIT_FILES: readonlyReadonly<{extensions:string[];name:"FIT Files"; }>[]; }>;LOG_LEVELS:Readonly<{ERROR:"error";INFO:"info";WARN:"warn"; }>;PLATFORMS:Readonly<{DARWIN:"darwin";LINUX:"linux";WIN32:"win32"; }>;SETTINGS_CONFIG_NAME:"settings";THEME_STORAGE_KEY:"ffv-theme";UPDATE_EVENTS:Readonly<{AVAILABLE:"update-available";CHECKING:"update-checking";DOWNLOAD_PROGRESS:"update-download-progress";DOWNLOADED:"update-downloaded";ERROR:"update-error";NOT_AVAILABLE:"update-not-available"; }>; }>;ensureFitParserStateIntegration: () =>Promise<void>;exposeDevHelpers: () =>void;getAppState: (statePath:string) =>any;getThemeFromRenderer: (win:any) =>Promise<string>;initializeApplication: () =>Promise<any>;isWindowUsable: (win:any) =>boolean;logWithContext: (level:string,message:string,context?:Record<string,unknown>) =>void;resolveAutoUpdaterAsync: () =>Promise<any>;resolveAutoUpdaterSync: () =>any;sendToRenderer: (win:any,channel:string, ...args:any[]) =>void;setAppState: (statePath:string,value:any,options?:Record<string,any>) =>void;setupApplicationEventHandlers: () =>void;setupAutoUpdater: (mainWindow:any,providedAutoUpdater?:any) =>void;setupIPCHandlers: (mainWindow:any) =>void;setupMainLifecycle: (deps:LifecycleDependencies) =>void;setupMenuAndEventHandlers: () =>void;startGyazoOAuthServer: (port?:number) =>Promise<{success:boolean;message:string;port?:number; }>;stopGyazoOAuthServer: () =>Promise<{success:boolean;message:string; }>;validateWindow: (win:any,context?:string) =>boolean; }
Defined in: main.js:41
Type Declarationβ
CONSTANTSβ
CONSTANTS:
Readonly<{DEFAULT_THEME:"dark";DIALOG_FILTERS:Readonly<{ALL_FILES: readonly (Readonly<{extensions:string[];name:"FIT Files"; }> |Readonly<{extensions:string[];name:"All Files"; }>)[];EXPORT_FILES: readonly (Readonly<{extensions:string[];name:"CSV (Summary Table)"; }> |Readonly<{extensions:string[];name:"GPX (Track)"; }> |Readonly<{extensions:string[];name:"All Files"; }>)[];FIT_FILES: readonlyReadonly<{extensions:string[];name:"FIT Files"; }>[]; }>;LOG_LEVELS:Readonly<{ERROR:"error";INFO:"info";WARN:"warn"; }>;PLATFORMS:Readonly<{DARWIN:"darwin";LINUX:"linux";WIN32:"win32"; }>;SETTINGS_CONFIG_NAME:"settings";THEME_STORAGE_KEY:"ffv-theme";UPDATE_EVENTS:Readonly<{AVAILABLE:"update-available";CHECKING:"update-checking";DOWNLOAD_PROGRESS:"update-download-progress";DOWNLOADED:"update-downloaded";ERROR:"update-error";NOT_AVAILABLE:"update-not-available"; }>; }>
Shared constants for the Electron main process. Extracted from the legacy monolithic main.js to help other modules consume configuration without re-defining values.
ensureFitParserStateIntegration()β
ensureFitParserStateIntegration: () =>
Promise<void>
Ensures that fit parser state integration has executed once. Subsequent calls reuse the same promise to avoid re-registering identical adapters.
Returnsβ
Promise<void>
Initialization guard promise.
exposeDevHelpers()β
exposeDevHelpers: () =>
void
Attaches debugging helpers to the global object for development builds. Mirroring the legacy behaviour keeps the devtools workflow untouched while allowing the logic to live outside main.js.
Returnsβ
void
getAppState()β
getAppState: (
statePath:string) =>any
Returns the current value for a state key from the main process state manager.
Parametersβ
statePathβ
string
Dot-notation state path (e.g. "fitFile.lastResult").
Returnsβ
any
Stored state value.
getThemeFromRenderer()β
getThemeFromRenderer: (
win:any) =>Promise<string>
Fetches the persisted theme from the renderer by reading localStorage. The helper is resilient to missing BrowserWindow instances so Jasmine/Vitest environments without a DOM do not crash.
Parametersβ
winβ
any
BrowserWindow whose webContents will be queried.
Returnsβ
Promise<string>
Resolved theme name falling back to the default theme.
initializeApplication()β
initializeApplication: () =>
Promise<any>
Bootstraps the main application window and wires up auto-updater integration. Extracted from the monolithic main.js to make the orchestration easier to comprehend.
Returnsβ
Promise<any>
Resolves with the created BrowserWindow instance.
isWindowUsable()β
isWindowUsable: (
win:any) =>boolean
Determines whether the provided BrowserWindow is still usable.
Parametersβ
winβ
any
Candidate BrowserWindow instance.
Returnsβ
boolean
True when the window and its webContents remain alive.
logWithContext()β
logWithContext: (
level:string,message:string,context?:Record<string,unknown>) =>void
Logs a message from the main process with optional structured context for easier debugging. The implementation mirrors the behaviour that previously lived in main.js so existing log expectations in tests remain unchanged.
Parametersβ
levelβ
string
Console method to invoke.
messageβ
string
Message to log.
context?β
Record<string, unknown> = {}
Optional context payload serialized to JSON.
Returnsβ
void
resolveAutoUpdaterAsync()β
resolveAutoUpdaterAsync: () =>
Promise<any>
Returnsβ
Promise<any>
resolveAutoUpdaterSync()β
resolveAutoUpdaterSync: () =>
any
Resolves electron-updater synchronously supporting both CJS and ESM default exports.
Returnsβ
any
autoUpdater instance or null when unavailable.
sendToRenderer()β
sendToRenderer: (
win:any,channel:string, ...args:any[]) =>void
Sends an IPC message to the renderer only when the target window is still usable.
Parametersβ
winβ
any
BrowserWindow instance.
channelβ
string
IPC channel.
argsβ
...any[]
Payload forwarded to webContents.send.
Returnsβ
void
setAppState()β
setAppState: (
statePath:string,value:any,options?:Record<string,any>) =>void
Persists a value into main process state.
Parametersβ
statePathβ
string
Dot-notation path to update.
valueβ
any
Value to persist.
options?β
Record<string, any> = {}
Additional metadata forwarded to the state manager.
Returnsβ
void
setupApplicationEventHandlers()β
setupApplicationEventHandlers: () =>
void
Registers core application-level Electron event handlers (activate, window-all-closed, etc.).
Returnsβ
void
setupAutoUpdater()β
setupAutoUpdater: (
mainWindow:any,providedAutoUpdater?:any) =>void
Configures electron-updater for the application, wiring all event handlers to relay progress to the renderer. The logic matches the historic main.js implementation so behaviour and logging stay consistent.
Parametersβ
mainWindowβ
any
BrowserWindow receiving updater events.
providedAutoUpdater?β
any
Optional pre-resolved autoUpdater (used by tests).
Returnsβ
void
setupIPCHandlers()β
setupIPCHandlers: (
mainWindow:any) =>void
Registers all IPC handlers for the main process. The structure mirrors the legacy implementation but lives in a dedicated module to keep main.js lean.
Parametersβ
mainWindowβ
any
Primary BrowserWindow instance (may be undefined in some test scenarios).
Returnsβ
void
setupMainLifecycle()β
setupMainLifecycle: (
deps:LifecycleDependencies) =>void
Registers the full main-process lifecycle, including test fallbacks that eagerly initialize the window and IPC wiring.
Parametersβ
depsβ
Returnsβ
void
setupMenuAndEventHandlers()β
setupMenuAndEventHandlers: () =>
void
Registers menu-related IPC handlers and listeners.
Returnsβ
void
startGyazoOAuthServer()β
startGyazoOAuthServer: (
port?:number) =>Promise<{success:boolean;message:string;port?:number; }>
Starts the local OAuth callback server used for Gyazo integrations. The implementation mirrors the previous main.js logic, including informative logging and defensive error handling for tests.
Parametersβ
port?β
number = 3000
Desired port for the callback server.
Returnsβ
Promise<{ success: boolean; message: string; port?: number; }>
Server status payload.
stopGyazoOAuthServer()β
stopGyazoOAuthServer: () =>
Promise<{success:boolean;message:string; }>
Stops the Gyazo OAuth callback server if it is currently running.
Returnsβ
Promise<{ success: boolean; message: string; }>
Server shutdown payload.
validateWindow()β
validateWindow: (
win:any,context?:string) =>boolean
Validates that a BrowserWindow is usable and logs a structured warning when it is not.
Parametersβ
winβ
any
Target BrowserWindow instance.
context?β
string = "unknown operation"
Description of the operation requiring the window.
Returnsβ
boolean
True when the window can be used.