mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
17 lines
419 B
JavaScript
17 lines
419 B
JavaScript
|
|
const { ipcMain, BrowserWindow } = require("electron");
|
||
|
|
const { getAction } = require("./actions");
|
||
|
|
|
||
|
|
ipcMain.on("fromRenderer", async (event, args) => {
|
||
|
|
const { type } = args;
|
||
|
|
const action = getAction(type);
|
||
|
|
if (!action) return;
|
||
|
|
await action.action(args);
|
||
|
|
});
|
||
|
|
|
||
|
|
module.exports.sendMessageToRenderer = function (type, payload = {}) {
|
||
|
|
global.win.webContents.send("fromMain", {
|
||
|
|
type,
|
||
|
|
...payload,
|
||
|
|
});
|
||
|
|
};
|