Is there a way to call a function in contextBridge, that won't be read in renderer.js, from main.js in electron?

183 Views Asked by At

I hope you are having a good morning. I was wondering if there was a way to call a regular function in contextBridge in preload.js from main.js that will not be read by renderer.js. For example when wanting to call a regular function in contextBridge, not having to use ipcRenderer, you simply do window.preloader.functionName() in renderer.js.

I want to do the exact same thing except in main.js. I have tried doing win.webContents.functionName(); in main.js, however, I receive the error of TypeError: Cannot read properties of undefined (reading ‘functionName’)

Please let me know if you have a solution! Thanks.

0

There are 0 best solutions below