26 lines
460 B
JavaScript
26 lines
460 B
JavaScript
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,
|
|
};
|