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

21 lines
822 B
JavaScript

const { contextBridge, ipcRenderer } = require("electron");
// const path = require("path");
// 安全暴露数据库操作方法
contextBridge.exposeInMainWorld("electronAPI", {
updateConfig: async (tableName, key, value) => {
return await ipcRenderer.invoke("update-config", tableName, key, value);
},
getConfig: async (tableName, key) => {
return await ipcRenderer.invoke("get-config", tableName, key);
},
bulkInsertSystemMessages: async messages => {
return await ipcRenderer.invoke("bulk-insert-system-messages", messages);
},
startProcess: (fileName, exeName) =>
ipcRenderer.invoke("start-process", fileName, exeName),
stopProcess: (fileName, exeName) =>
ipcRenderer.invoke("stop-process", fileName, exeName),
stopAllProcesses: () => ipcRenderer.invoke("stop-all-process")
});