const { contextBridge, ipcRenderer, webUtils } = require("electron"); contextBridge.exposeInMainWorld("libraryAPI", { load: () => ipcRenderer.invoke("library:load"), save: (data) => ipcRenderer.invoke("library:save", data), settings: () => ipcRenderer.invoke("settings:load"), openVault: () => ipcRenderer.invoke("vault:open"), createVault: (name) => ipcRenderer.invoke("vault:create", name), switchVault: (id) => ipcRenderer.invoke("vault:switch", id), removeVault: (id) => ipcRenderer.invoke("vault:remove", id), importPdfs: (existingNames) => ipcRenderer.invoke("pdf:import", existingNames), importPdfPaths: (filePaths, existingNames) => ipcRenderer.invoke("pdf:importPaths", filePaths, existingNames), openPdf: (pdfPath) => ipcRenderer.invoke("pdf:open", pdfPath), pathForFile: (file) => webUtils.getPathForFile(file), });