0
需求:电子渲染过程cannt使用ipcRenderer.send()
渲染过程需要将数据发送到主进程。
我的代码:
//index.js (renderer process)
const {ipcRenderer} = require('electron')
class WebWindow {
constructor() {
...
setInterval(() => {
this.foo()
}, 2000)
// or
let that = this
setInterval(function() {
thar.foo()
}, 2000)
}
foo() {
data = {}
ipcRenderer.send('async-cookies', data)
}
}
问题 我得到的错误:
Uncaught Exception:
TypeError: Cannot read property 'send' of undefined
at Function.eval
Semms cannt中的setInterval使用IPC?
我该怎么办..
谢谢!
使用箭头函数时,您不需要播放这个/那个/自我重新声明游戏,并且您的代码不显示该声明? –
我编辑过。这两个代码我都试过了.. – steve