Skip to main content

getOverlayFileName

FitFileViewer - API Documentation v29.9.0


FitFileViewer - API Documentation / utils/files/import/getOverlayFileName / getOverlayFileName

Function: getOverlayFileName()

getOverlayFileName(idx: number): string

Defined in: utils/files/import/getOverlayFileName.js:43

Gets the filename for a loaded FIT file overlay by index

Safely retrieves the file path from the loaded FIT files state with proper validation. Returns an empty string if the index is out of bounds or file data is unavailable.

Parameters​

idx​

number

Index of the overlay file

Returns​

string

The filename or empty string if not found

Example​

// Get filename for the first overlay file
const filename = getOverlayFileName(0);

// Handle case where file doesn't exist
const filename = getOverlayFileName(999); // Returns ""

Throws​

If idx is not a valid number