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