You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.2 KiB

3 weeks ago
const { contextBridge, ipcRenderer } = require('electron')
const Store = require("electron-store");
const store = new Store();
contextBridge.exposeInMainWorld('api', {
createUtilsWindow: (flag) => {
ipcRenderer.send('create-utils-window', flag)
},
uploadFile: (id) => {
ipcRenderer.send("upload-file", id);
},
watchuploadFile: (id) => {
ipcRenderer.invoke("watch-upload-file", id);
},
getConfig: () => ipcRenderer.invoke('get-config'),
updateConfig: (config) => ipcRenderer.invoke('update-config', config),
getStoreValue: (key) => store.get(key),
removeStoreValue: (key) => store.delete(key),
watchUploadLatestAnalysisFile: (id) => {
ipcRenderer.invoke("watch-upload-analysis-file", id);
},
// 读取C盘文件夹文件
readCFolder: (config) => ipcRenderer.invoke('read-c-folder', config),
// 可选:获取Electron版本(测试用)
getElectronVersion: () => process.versions.electron,
saveFileInfo: (fileInfoList) => ipcRenderer.invoke('save-file-info', fileInfoList), // 新增
getSavedFileInfo: () => ipcRenderer.invoke('get-saved-file-info'), // 新增
renameFile: (data) => ipcRenderer.invoke('rename-file', data),
})