Monday, 15 May 2017

Electron ipcMain undefined

The following code produces an error

const ipcMain = require('electron').ipcMain;
ipcMain.on('open-file-dialog', function (event) {});

This error is thrown in console:

Uncaught TypeError: Cannot read property 'on' of undefined

As mentioned on this question, i also tried using

const ipcMain = require('ipc-main');

but am getting the same error.

Seems that ipcRenderer is defined in the electron package, but not ipcMain. How do i fix this? Already tried reinstalling the latest nodejs and running npm install on a fresh checkout.



via Tom

No comments:

Post a Comment