update directory live
This commit is contained in:
@@ -333,11 +333,26 @@ app.whenReady().then(async () => {
|
||||
"729a0d21d783654c68f1a0123e2a0e986350de536b5324f1f35876ea12ffeaf5"
|
||||
);
|
||||
await notesAPI.init();
|
||||
ipcMain.handle("notesAPI:call", (_, method, args) => {
|
||||
const broadcastNoteChange = (event, data) => {
|
||||
BrowserWindow.getAllWindows().forEach((win) => {
|
||||
win.webContents.send(event, data);
|
||||
});
|
||||
};
|
||||
ipcMain.handle("notesAPI:call", async (_, method, args) => {
|
||||
if (!notesAPI[method]) {
|
||||
throw new Error("Invalid method");
|
||||
}
|
||||
return notesAPI[method](...args);
|
||||
const result = await notesAPI[method](...args);
|
||||
if (method === "createNote") {
|
||||
broadcastNoteChange("note-created", result);
|
||||
} else if (method === "updateNote") {
|
||||
broadcastNoteChange("note-updated", result);
|
||||
} else if (method === "updateNoteMetadata") {
|
||||
broadcastNoteChange("note-updated", result);
|
||||
} else if (method === "deleteNote") {
|
||||
broadcastNoteChange("note-deleted", { id: args[0] });
|
||||
}
|
||||
return result;
|
||||
});
|
||||
electronApp.setAppUserModelId("com.electron");
|
||||
app.on("browser-window-created", (_, window) => {
|
||||
|
||||
Reference in New Issue
Block a user