notes API cleanup
This commit is contained in:
@@ -3,16 +3,15 @@ const electron = require("electron");
|
||||
const api = {
|
||||
openNoteWindow: (noteId) => {
|
||||
electron.ipcRenderer.send("open-note-window", noteId);
|
||||
},
|
||||
listNotes: () => electron.ipcRenderer.invoke("notes:list"),
|
||||
createNote: (path, content) => electron.ipcRenderer.invoke("notes:create", { path, content }),
|
||||
createNoteDir: (path) => electron.ipcRenderer.invoke("notes:createDir", path),
|
||||
readNote: (path) => electron.ipcRenderer.invoke("notes:read", path),
|
||||
updateNote: (path, content) => electron.ipcRenderer.invoke("notes:update", { path, content })
|
||||
}
|
||||
};
|
||||
const notesAPI = {
|
||||
call: (method, ...args) => electron.ipcRenderer.invoke("notesAPI:call", method, args)
|
||||
};
|
||||
if (process.contextIsolated) {
|
||||
try {
|
||||
electron.contextBridge.exposeInMainWorld("api", api);
|
||||
electron.contextBridge.exposeInMainWorld("notesAPI", notesAPI);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user