Detect if it’s Electron runtime
When I need to share the same codebase between a WebApp and an ElectronApp, I use the following condition to run specific code based on the host environment:
if (window.process && window.process.type && window.process.type === 'renderer') {
// run code for Electron only
}
Not beautiful but it works!
Spotted a typo or (likely) a grammar error? Send a pull request.