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.
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
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"),
|
|
stopChatProcesses: () => ipcRenderer.invoke("stop-chat-process"),
|
|
clearSystemMessages: () => ipcRenderer.invoke("clear-system-messages"),
|
|
getAllSystemMessages: () => ipcRenderer.invoke("get-all-system-messages"),
|
|
updateMessageById: async (id, data) => {
|
|
return await ipcRenderer.invoke("update-message", id, data);
|
|
}
|
|
});
|