Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It provides a runtime with rich native (operating system) APIs. You could see it as a variant of the Node.js runtime that is focused on desktop applications instead of web servers.
This doesn’t mean Electron is a JavaScript binding to graphical user interface (GUI) libraries. Instead, Electron uses web pages as its GUI, so you could also see it as a minimal Chromium browser, controlled by JavaScript.
Electron is just like WebViews for iOS/Android. This provides an opportunity to code once and run as web / desktop app. Just imagine if any of your web applications can be run as both desktop and web application and they are no different for the end user providing the same unified user experience across web and desktop and even across platforms (Mac, Linux, or PC). JavaScript code can run on Mobiles too. Would that be too much to expect ? … 🙂
With the arrival of HTML5, we now have low-level functionality added to modern browsers, like the ability to read and write files to a computer’s file system. That opens up the possibility to create offline Single Page Applications (SPAs) using a web browser as a platform.
That presents some interesting possibilities, such as the ability to deploy your application on multiple operating systems.
Some of the key advantages:
- Single code can run on all platforms (Mac, Windows and Linux)
- Leverages the latest in web technologies (Chromium and Node.js)
- Build fully-featured desktop applications using the same technologies used for the Web
- Write HTML and JS files as you would normally do and Package with Electron
- Code can be reused to host it as web application on cloud as such with minor modifications.
Here below are some apps built using Electron
- Atom text editor
- Visual Studio Code
- Slack app and many more listed here…
Why Desktop Applications again?
I see there are certain cases where people would prefer having a desktop application instead of web applications. Specifically in terms of user experience and speed, desktop applications are proven to be superior traditionally. For example, your software development tools, & IDE are preferred to be desktop apps instead of web right? Similarly there are other areas like if you would want apps to be available in your system tray and provide desktop notifications, game development etc.
Traditionally, the biggest disadvantage of having a desktop app was – it was built for specific platform and the same code cannot be used in another platform / OS. That was the key which led to the evolution and popularity of web technology in my opinion.
Alternatives
Electron is not the only solution out there. There are few more similar alternatives like TiDeSDK, Sencha Desktop Manager or NW.js
Leave a Reply