Sharing between main and renderer process

In short

In main process:

global.something = value;

In renderer process:

const remote = require('electron').remote;
var something = remote.getGlobal('something');

Longer version

To use same instance between main and renderer process, you can use global object from Node. To demonstrate this, let’s add logger to sample Todo application.

In main.js we’re going to create logger instance which can be required and used in all other renderers.

Read More