Files
ResourceLoader/electron/preload.js
Zaine Qayyum 9e075ec941 Testing
2026-08-19 09:56:06 +01:00

17 lines
854 B
JavaScript

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),
});