我有一个我建的电子应用程序。从我的主要流程我打开一个新窗口:
electron = require('electron')
const {globalShortcut} = require('electron')
const app = electron.app
runnerWindow = new BrowserWindow({width: width, height: height})
var path = `file://${__dirname}/app/template/index.html`
console.log(path)
runnerWindow.loadURL(path)
runnerWindow.webContents.openDevTools()
然后从那个html里面我打电话:
if (window.module) module = window.module;
const ipc = require('electron').ipcRenderer
我得到的错误是:
Uncaught TypeError: require(...).ipcRenderer is not a function
为什么我不能从文件中获取ipc?我有其他窗口我打开并使用ipc,但它不适用于这个特定的窗口。