Skip to content
loading...

Answer: How to pass parameters from main process to render processes in Electron

circleoncircles profile image Nutchanon Ninyawee twitter logo github logo ・1 min read

Using query string along with win.loadFile(),

// main process or renderer process 1
data = {"age": 12, "healthy": true}

let win = new BrowserWindow({
        webPreferences: {
          nodeIntegration: true
        }
      });

win.loadFile("public/print.html", {query: {"data": JSON.stringify(data)}});
// renderer process 2
const querystring = require('querystring');
let query = querystring.parse(global.location.search);
let data =
twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Aug 1 '19

Which dev.to loading GIF do you prefer?

I made some dev.to loading gifs

Nutchanon Ninyawee profile image
Coding Python, Contributing Open Source on a daily basis. In my 20s, I decided to finish my digital delegator.