Skip to main content

handleOpenFile

FitFileViewer - API Documentation v29.4.0


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

Function: handleOpenFile()

handleOpenFile(params: { isOpeningFileRef: Object; openFileBtn: HTMLElement; setLoading: Function; showNotification: Function; }, options?: { timeout?: number; validateFileSize?: boolean; }): Promise<boolean>

Defined in: utils/files/import/handleOpenFile.js:67

Handles file opening logic with comprehensive error handling and state management

Parameters​

params​

Configuration object for file opening

isOpeningFileRef​

Object

Reference object to track opening state

openFileBtn​

HTMLElement

Open file button element

setLoading​

Function

Function to set loading state

showNotification​

Function

Function to show notifications

options?​

Additional options

timeout?​

number

Timeout for file operations in milliseconds

validateFileSize?​

boolean

Whether to validate file size

Returns​

Promise<boolean>

True if file was successfully opened and processed

Example​

// Basic usage
const success = await handleOpenFile({
isOpeningFileRef: { value: false },
openFileBtn: document.getElementById('openFileBtn'),
setLoading: (loading) => showLoadingSpinner(loading),
showNotification: (msg, type) => displayMessage(msg, type)
});

@public