August last year, Mo Bitar, wrote an article on dev.to titled In Defense of Electron. The comments quickly descended into debates about RAM usage and attacks on JavaScript, with such comments as:
Web technology is for the web. Leave it there.
Electron is a disgrace to the programming community.
Software devs who ignore the engineering principles of yesterday in favor of hogging resources because it's convenient for you are what's wrong with the world today. People like you are dragging down the software industry by adding garbage to your apps faster than hardware can expand. This needs to stop.
Wow. Probably not the reaction fellow Electron devs would have hoped for but one we have come to expect. Given all the hate, I would like to take the time to offer my own defence of Electron.
Let’s start with the two Electron apps I have created: Browserosaurus and SpotSpot.
Browserosaurus
A browser prompter for macOS. It works by setting itself as the default browser; any clicked links in non-browser apps are now sent to Browserosaurus where it’ll present you with a menu of all your installed browsers. You may now decide which browser you’d like to continue opening the link with.
I first created this because at work I do not really have a default browser; often opening links from email, Slack, Terminal etc. and then copying the link from the opened browser into the browser I intended it for. I also like that it allows me to back-out of opening a browser by simply hitting escape or clicking outside Browserosaurus’s picker window.
When first looking for a solution, I found there were various apps in existence but none that quite offered the simplicity of what I wanted. It basically came down to: “how hard can it be?”. Once I had figured out how to scan the system for installed apps, the rest fell into place.
SpotSpot
An always on-top, mini-player for controlling Spotify in macOS. It shows the current album art, track and artist names, and displays player controls when rolled over with the mouse.
This one had a simple requirement: I like to know what is playing at a glance. Most other solutions I found for this involved sticking the currently playing track in the menubar. Two reasons I prefer my approach: firstly, I originally had a 13” MacBook and the menubar was already crammed full of indicators that I like to always have in view. Secondly, I get to see the great album art.
I designed SpotSpot to look like the now-playing widget in iOS’s control centre. I like the 1:1 (square) ratio of the window and how I can shrink it right down to be tucked away in a less-used area of my screen.
I thought this was a post about defending Electron?
It is. If you have read the above, you will notice many uses of the words “I”, “me”, and “my”… I made those apps for me. They do what I want, the way I want, and if I ever feel like changing something with them, I can. I am a JavaScript developer and Electron has allowed me to extend my knowledge to the desktop without having to start from scratch, which is awesome.
If we must talk about system usage, both my apps idle at essentially 0% CPU and use about 100MB of RAM, which is just fine by me.
Thank-you for reading and despite my emphasis on these being my projects, I am always happy to hear suggestions and review pull-requests for any of my open source projects. You can see my portfolio here: http://wstone.io/
Happy coding :)
Top comments (3)
Yeah, I don't get all the hate for Electron. I use VS Code and have never had a concern with it for RAM or CPU usage. Webpack and Elm compilation are far bigger CPU hogs. We've even considered using it for internal desktop apps, because web stuff is our wheelhouse and frankly I'm not impressed with desktop UI frameworks I've used. If it is significantly faster for us to dev, then RAM usage is a small price to pay. The part of Electron I expect to be difficult is integrations with other software, like QuickBooks. I don't actually want to write javascript code for that.
Some people really do hate Electron: electron.wtf/2017/10/17/web-browse...
Nice.
I wonder if WebAssembly would somehow affect the performance of Electron applications.