How to differentiate between the main process and renderer process in Electron (atom shell)?
Asked
Active
Viewed 5,595 times
18
-
2I am not sure what you are asking for here... can you provide a more in depth explanation of what you are looking for? – Shawn Rakowski Jul 08 '15 at 16:43
-
You might find this answer of mine helpful: http://stackoverflow.com/a/29868175/352784. But it's really hard to understand what is the exact thing you're trying to find out, try to ask a more specific question. – Konstantin Grushetsky Jul 08 '15 at 22:01
-
I think this question is clear enough though. Maybe it's because it has been improved? – hackjutsu Jul 12 '17 at 21:48
3 Answers
0
This library might help you. It has simple API:
var isRenderer = require('is-electron-renderer')
console.log(isRenderer); //true or false

Olim Saidov
- 2,796
- 1
- 25
- 32
-1
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'

Marshal
- 4,452
- 1
- 23
- 15