从前端窗口向电子浏览器窗口发送一些数据

时间:2019-02-11 10:08:03

标签: node.js electron

我想将一个对象从前端窗口发送到电子的末端。 我尝试过:

html:

const ipcRender = require('electron').ipcRenderer;
ipcRender.send('test', { test: null});

节点:

mainWindow.webContents.on('test', (event, data) => {
  console.log(true);
  console.log(data);
});

,在控制台中看不到任何内容。有什么事吗 谢谢!

1 个答案:

答案 0 :(得分:1)

我找到了解决方案,但是如果解决方法不正确,请对其进行评论。 因此,必须使用从电子导入的“ ipcMain”代替“ Node”中的“ mainWindo.webContents”:

column "Parent license" do |license|
  span { license.license.to_s }
end
相关问题