Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to Add Main Module API to Renderer process

//First install the remote module using
> npm install @electron/remote 

//In the new versions of electron, you have to include remote in renderer as:
const remote = require('@electron/remote');
const { net } = remote;

//And in your main.js file add the following
const remoteMain = require('@electron/remote/main');
remoteMain.initialize();

//Also, after creating the mainWindow object
remoteMain.enable(mainWindow.webContents)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #Add #Main #Module #API #Renderer #process
ADD COMMENT
Topic
Name
3+3 =