return "Main response!";
});
</pre>
*preload.js
<pre>
const electron = require('electron');
const { ipcRenderer, contextBridge } = electron;
contextBridge.exposeInMainWorld(
"api",
{
openWinWitMessage: (message) => {
ipcRenderer.invoke('invoke-test', message).then((data) => {
console.log("Response from main:" + data);
});
}
}
);
</pre>