handleOpenFile
FitFileViewer - API Documentation v29.9.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:80
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. Default is {}
timeout?β
number
Timeout for file operations in
milliseconds. Default is 30000
validateFileSize?β
boolean
Whether to validate file
size. Default is true
Returnsβ
Promise<boolean>
True if file was successfully opened and processed
Exampleβ
// Basic usage
const success = await handleOpenFile({
isOpeningFileRef: { value: false },
openFileBtn: document.getElementById("open_file_btn"),
setLoading: (loading) => showLoadingSpinner(loading),
showNotification: (msg, type) => displayMessage(msg, type),
});