Device compatibility is necessary is to provide seamless experience across various platforms, whether it's a website, mobile or a desktop application. For example, making a web application available as a desktop app allows it to be accessible anytime, especially if it supports offline access.
These days, it easier to take an already developed website and convert it to a mobile or desktop app. In the past, this required developers to understand platform-specific languages, but now numerous tools available make the process much easier.
In this article, we will cover the steps to convert a web application into a desktop app and why you might want to do it.
TL; DR:
Electron is a framework that enables developers to convert web applications to desktop applications. It combines chromium and Node.js, which gives applications access to the native features of operating systems such as Windows or macOS. Electron makes it faster for developers to build desktop apps without learning device-specific languages.
What is Electron.js?
Electron JS or Electron.js is an open-source runtime framework created by Cheng Zhao. It enables developers to create cross-platform desktop applications using web technologies such as HTML, CSS, and JavaScript.
Electron is based on Node.js, and it's a framework that combines Chromium rendering engine, which is used for Google Chrome, with Node.js runtime, a server-side JavaScript engine that also provides web code access to native operating system APIs.
Features of Electron
Features of Electron JS include the following:
Cross-platform Compatibility: Electron.js makes it possible for developers to run applications for multiple operating systems, such as Mac, Windows, and Linux. This ensures that apps are consistent across different environments, improving users' experience.
Web Technology Integration: Electron.js makes it possible for developers to build desktop applications using web technologies, including HTML, CSS, and JavaScript, which also allows them to use existing tools and frameworks to speed up development.
Chromium Rendering Engine: The Chromium rendering engine, which powers Google Chrome, is what Electron.js uses to ensure that it renders with high performance and is compatible with modern web standards.
Node.js Runtime: Electron.js integrates with Node.js to enable a range of server-side functionality so that developers can use Node.js modules for tasks such as file system operations, network communication, etc
Two essential processes in Electron.js include;
Main Process: The main process manages the lifecycle of Electron applications. It handles the following;
Browser Window Creation: This enables the creation and management of browser windows, which serve as the graphical interface for the application.
Application Lifecycle Management: The main process uses the Electron app module to manage the lifecycle of an application. This module provides a set of events and methods that allow developers to add custom application behaviour, e.g., closing an application or displaying information panels.
Native APIs: The main process extends Electron's features beyond wrapping web contents in a desktop app using Chromium; it also adds custom APIs to interact with the user's operating system. Electron provides built-in modules that allow applications to interact with native desktop functionality such as tray icons, dialogs, and menus.
Renderer Process: Electron app creates a renderer process for every BrowserWindow. The renderer displays the user interface, and standard web technologies can be used in the renderer, such as;
HTML and CSS Rendering: This processes and displays web content and styling.
DOM Access: This allows scripts access to the DOM so they can manipulate the elements on pages.
Web API: This supports browser APIs such as fetch, WebSocket’s, audio, and video applications. This ensures that the Electron renderer has the same capabilities as the web page.
Also, the renderer process doesn't have direct access to Node.js or Electron APIs by default. To include NPM modules or JavaScript libraries in the Apps UI, developers often use a bundler toolchain like Webpack or Parcel to convert the modules into a format that is compatible with the renderer's environment.












