Electron + angularjs IPC机制

我正在尝试在Electron中使用AngularJs。 我感到困惑的是, 这里的电子文档build议使用类似于:

// In renderer process (web page). const ipcRenderer = require('electron').ipcRenderer; console.log(ipcRenderer.sendSync('synchronous-message', 'ping')); // prints "pong" ipcRenderer.on('asynchronous-reply', function(event, arg) { console.log(arg); // prints "pong" }); ipcRenderer.send('asynchronous-message', 'ping'); 

但是由于Angular在浏览器(webkit)中运行,我不能使用require来获取ipcRenderer。

如何克服这个问题。

可以在电子中使用require – 它使用此function扩展webkit API。 基本上整个NPM是在你的处置。 那么,有些东西显然是行不通的,但是require会的。