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

Using logger with Electron and AngularJS

Angular provides $log for logging, but if you'd like to use different logger (and use it throughout your Electron app), you will have to handle it bit more differently.

Motivation

I'd like to have single logger to output logs to console and external file. It has to work in both AngularJS files and Electron files.

For my project, I've chosen to go with Winston which seems pretty powerful and stable,

Read More