use sendToRender

This commit is contained in:
srgooglo 2023-11-21 19:13:06 +01:00
parent 2c0533a16f
commit db3fe91bf0

View File

@ -0,0 +1,23 @@
import lodash from "lodash"
export default (event, data) => {
function serializeIpc(data) {
if (!data) {
return undefined
}
const copy = lodash.cloneDeep(data)
if (!Array.isArray(copy)) {
Object.keys(copy).forEach((key) => {
if (typeof copy[key] === "function") {
delete copy[key]
}
})
}
return copy
}
global.win.webContents.send(event, serializeIpc(data))
}