Accessing Electron instance in Atom?


Is it possible to get a reference to Electron from within an Atom package? For example, I’d like to be able to use Electron’s app API ( in Atom.


Atom is built on Electron, so Electron is just there. There’s nothing special you need to do to “get a reference to Electron”. One thing to keep in mind though, Atom packages run inside the renderer process. Electron’s app module is designed to be accessed from the main process. So if you want to use the app module, you’ll have to create some IPC code or remote across.


Hi, could you show how one could access the remote module from within an Atom package? You say it’s “just there” but I’ve looked through atom and atom.workspace and I’m not seeing anything, and require('electron') gives Cannot find module.


I believe that the version of Electron used in the stable version of Atom didn’t use require('electron') yet. You may want to use process.versions from the JavaScript Console and then look at the documentation for that version of Electron.


Ahh, it’s as simple as require('remote'). Thanks!