Passing values into BrowserWindow's js file from main process during loadURL


#1

I plan to use React to build my view based on the values passed from main process


#2

You can use did-finsih-load on windows.webContents to send message out to renderer

prefsWindow.webContents.on(‘did-finish-load’, function() {
console.log(“Web contents loaded”);
prefsWindow.webContents.send(“update-scaffold”,opts);
});

Or

As mentioned here,

you can do

// main process
win1.loadURL(file://${__dirname}/app/app.html?id=${id});

// rendered process
console.log(global.location.search);