Reputation: 827
How to differentiate between the main process and renderer process in Electron (atom shell)?
Upvotes: 19
Views: 6071
Reputation: 4880
Not sure if the high rated answer had been modified mistakenly. The correct logic should be:
const isRenderer = typeof process === 'undefined' || !process || process.type === 'renderer'
Upvotes: -1
Reputation: 2844
This library might help you. It has simple API:
var isRenderer = require('is-electron-renderer')
console.log(isRenderer); //true or false
Upvotes: 0