问题
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