Electron: Send message from BrowserWindow to Electron app

北战南征 提交于 2021-01-28 06:08:38

问题


I have an Electron app which uses a BrowserWindow to display a web app.

I want to be able to send a message from the angularjs web app to the Electron app.

I had something like this in mind:

//web app
window.notify('message','hello');

//Electron app
window.on('message',function(e){
  console.log(e.text);
};

Is this even possible?


回答1:


You can use ipcMain and ipcRenderer for sending messages between the main script and the client script.



来源:https://stackoverflow.com/questions/45091014/electron-send-message-from-browserwindow-to-electron-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!