fileset-desktop/ipc/ipc.js

26 lines
460 B
JavaScript
Raw Normal View History

2022-04-05 21:26:02 +08:00
const { openSite } = require("./site");
const { ipcRenderer } = require("electron");
const { reSize } = require("./windows");
const ipc = {
site: {
open: openSite,
},
windows: {
reSize: reSize,
},
};
function getAPI(namespace) {
let api = {};
for (const key in ipc[namespace]) {
api[key] = (...props) => ipcRenderer.send(namespace + "-" + key, ...props);
}
console.log(api);
return api;
}
module.exports = {
ipc,
getAPI,
};