Questions tagged [electron]

Electron (formerly Atom Shell) is a framework created by GitHub that lets you write cross-platform desktop applications using HTML, CSS and JavaScript. Electron is based upon Node.js and Chromium.

Electron (formerly Atom Shell) project was originally started by Cheng Zhao, one of the authors of NW.js (formerly known as node-WebKit), another Node.js-based platform for building desktop applications using HTML, CSS, and JavaScript. Cheng Zhao was hired by GitHub and began work on the framework on or about April 11th, 2013. On the 17th of April, 2015, with the release of version 0.24 the framework was renamed from Atom Shell to Electron.

One of the differences between Electron and NW.js frameworks is that the entry point for the app is actual JavaScript instead of an HTML page. This makes Electron more suitable for testing with PhantomJS, for instance.

Another difference is that the build process is also simpler for Electron using electron-builder, electron-forge and electron-packager. Since Electron uses libchromiumcontent to access Chromium's Content API, it's no longer required to obtain a copy of the Chromium source code. On that same note, the integration with Chromium is much more loosely coupled than in case of NW.js (which requires Chromium to be patched and maintained separately by the NW.js developers).

Probably, the most popular application built on top of Electron is a hackable text editor called Atom (also from GitHub). But there are some other interesting projects like Vivaldi Web browser, Mapbox Studio, an email client from Nylas, Slack desktop application, Pixate, Fireball game editor, Visual Studio Code, an SQL editor called Wagon, Mac app that runs Docker containers called Kitematic.


Resources :

15116 questions
35
votes
8 answers

How to make the dev tools not show up on screen by default in Electron?

I am using electron-react-boilerplate to create an Electron-React app. The dev tools show up on the screen by default. How can I make the dev tools only appear when I ask for them and not show up on launch? Also, there are no errors shown in the…
Kapil Gupta
  • 7,091
  • 5
  • 16
  • 25
34
votes
6 answers

How to use electron's app.getPath() to store data?

I want to store images on the users computer, so I figure it should be stored in users data folder, as described here. app.getPath(name) name. Returns String - A path to a special directory or file associated with name. On failure an Error is…
stackers
  • 2,701
  • 4
  • 34
  • 66
34
votes
3 answers

Electron - How to add external files?

I have an Electron app. I try to make the app open an .exe file. I created a directory in the root folder named lib and placed the .exe file there. In development, I have no problem opening the file by using __dirname + '/lib/file.exe, but when I…
user2298995
  • 2,045
  • 3
  • 19
  • 27
34
votes
2 answers

How to catch the event of clicking the app window's close button in Electron app

I wish to catch the event of clicking the app window's close button in Electron app. I'm trying to develope Electron app for Mac OSX. I want to hide the app window, not to terminate the app when a user clicks the window's close button like other…
yukib
  • 453
  • 1
  • 4
  • 6
33
votes
4 answers

How to set electron UserAgent

I need to set the UserAgent in electron to include the touch flag since I am writing the application for touch screens and it doesn't seem to auto detect that it is running on a touch screen. Any help would be nice, I already tried setting it in the…
zchrykng
  • 1,066
  • 1
  • 10
  • 20
32
votes
8 answers

How to pass parameters from main process to render processes in Electron

I have an Electron app that can open different windows. On app launch the app open a set of window(s) (that load the same HTML and JS files) but with params to change each window displayed infos. Example : app.on('ready', async () => { ... //…
damien
  • 669
  • 1
  • 6
  • 9
32
votes
3 answers

ES6 syntax import Electron (require..)

To learn the new ES6 syntax, I've been trying to refactor some JS code. I'm absolutely confused though by the whole import / export methods. How do I change this require statement into ES6? var remote = require('electron').remote I've seen this…
c1c1c1
  • 395
  • 1
  • 3
  • 9
31
votes
2 answers

electron-forge make won't build

An unhandled rejection has occurred inside Forge: Error: Cannot make for rpm, the following external binaries need to be installed: rpmbuild at MakerRpm.ensureExternalBinariesExist…
Tiny Tophy
  • 319
  • 1
  • 3
  • 5
31
votes
2 answers

array.length is zero, but the array has elements in it

I'm currently in the process practicing using electron, but I'm quite new with javascript and I've come across a problem which has me completely baffled. I have the following code: function getPaths() { var dirPath =…
Taira
  • 489
  • 2
  • 5
  • 10
31
votes
7 answers

Electron UI for Golang Program?

I'd like to make a GUI in Electron for a Desktop Application written in Go (currently it's a command line tool). What's the convention for communicating between the Electron and Go processes? Would simply using the Go binary as an API work? Some…
Ashkay
  • 786
  • 1
  • 8
  • 19
31
votes
4 answers

Showing window after it is fully loaded

When I create basic application and initialize it using electron command, it shows me a blank window and a moment later loads the content. Which event and which object should be used to show the window after the content is fully…
Are
  • 2,160
  • 1
  • 21
  • 31
30
votes
4 answers

Promise returned in function argument where a void return was expected

I'm working on an Electron application and I want to use async await in an anonymous function in my Main like this: process.on("uncaughtException", async (error: Error) => { await this.errorHandler(error); }); But this yields the Typescript…
mottosson
  • 3,283
  • 4
  • 35
  • 73
30
votes
3 answers

node module version conflict when installing modules for electron

I'm trying to make an Electron application (https://electron.atom.io/) that reads data from my serial port. I'm new to web technologies in general, I know some javascript, but I'm a c++ guy. So I pulled in their quick-start from github, ran npm…
Ryan
  • 340
  • 1
  • 3
  • 10
30
votes
5 answers

How to get folder path using electron

I am very new to the electron. Can anyone suggest me how to get a local folder's relative path using the electron? JavaScript does not have that capability. I have a Choose File button(see snapshot), so my question is that when I select a folder…
Surjeet Bhadauriya
  • 6,755
  • 3
  • 34
  • 52
30
votes
6 answers

Electron-packager: cannot find module

I trying to package my app using electron-Packager and this command: electron-packager . FooBar --platform=darwin --arch=x64 --version=0.36.9 (I'm using MacOsx) the app is created but when I run it I get a pop-up showing this: Uncaught…
navy1978
  • 1,411
  • 1
  • 15
  • 35