Introduction to ElectronJS

In this lesson we are going to learn about Introduction to ElectronJS.

 

 

 

Introduction to ElectronJS

ElectronJS is framework that allows developers to build cross platform desktop applications using web technologies such as JavaScript, HTML and CSS. it is built on top of Chromium, the open source version of Google Chrome and Node.js, which provides runtime environment for JavaScript.

with ElectronJS developers can use the same codebase to create applications for Windows, Mac and Linux. this eliminates the need to write separate code for different platforms and it makes the development faster and more efficient.

One of the main benefits of ElectronJS is that it allows developers to leverage their existing web development skills to create desktop applications. Developers can use popular web frameworks such as React, Angular or Vue.js to build the user interface and Node.js to handle the backend logic.

The structure of an ElectronJS application is composed of two main parts: main process, which runs on the desktop and manages the application’s lifecycle, and renderer process, which runs in a web page and handles the user interface. main process and the renderer process communicate with each other through inter process communication (IPC) mechanisms.

ElectronJS also provides set of builtin modules, such as the electron and remote modules, which allow developers to access native functionality of the operating system and perform tasks such as creating windows, accessing the file system or displaying notifications.

ElectronJS is widely used by many popular applications such as Visual Studio Code, Slack and Discord. it is also good for creating desktop applications that require offline capabilities, native system integration or access to hardware devices.

 

What Applications are Made with Electronjs ?

Many popular applications are built using ElectronJS, some examples include:

  1. Visual Studio Code – code editor developed by Microsoft.
  2. Slack – popular team collaboration tool.
  3. Discord – communication platform for gamers.
  4. GitHub Desktop – desktop client for the GitHub version control platform.
  5. Spotify – music streaming service.
  6. Twitch Studio –  live streaming software for Twitch.
  7. Postman – tool for testing and documenting APIs.
  8. Atom – code editor developed by GitHub.
  9. Zoom – video conferencing platform.
  10. Postico –  tool for managing PostgreSQL databases.

These are just few examples but there are many other applications that are built using ElectronJS. It’s widely used framework and is well suited for creating cross platform desktop applications that require offline capabilities, native system integration, or access to hardware devices.

 

 

Pros and Cons of Electronjs

Pros of ElectronJS:

  1. Cross-platform compatibility: ElectronJS allows developers to build applications that run on Windows, Mac and Linux using single codebase.
  2. Leverage existing web development skills: ElectronJS allows developers to use web technologies such as JavaScript, HTML and CSS to build desktop applications.
  3. Access to native functionality: ElectronJS provides builtin modules that allow developers to access native functionality of the operating system, such as creating windows, displaying notifications or accessing the file system.
  4. Large developer community: ElectronJS has large and active developer community which means that there are many resources and tutorials available to help developers get started.
  5. Large number of pre built modules: ElectronJS has large number of pre built modules that can be easily integrated into an application which can save a lot of development time.

 

Cons of ElectronJS:

  1. Large application size: ElectronJS applications tend to be larger in size than native applications because they include the Chromium browser and Node.js runtime.
  2. High memory usage: ElectronJS applications can use more memory than native applications because they run in web browser environment.
  3. Slower performance: ElectronJS applications may perform slower than native applications because they run in web browser environment.
  4. Security concerns: ElectronJS applications are built on top of Chromium which means that they are vulnerable to the same security issues as Chrome.
  5. Difficulties with packaging and distribution: Packaging and distributing ElectronJS applications can be more difficult than packaging and distributing native applications because they require the Chromium browser and Node.js runtime to be included.

 

 

Basic Example of ElectronJS

This is basic example of an ElectronJS application that displays window with  Hello World message make sure that you have installed ElectronJS

 

 

This code creates new browser window with the specified width and height and loads the index.html file into the window. the nodeIntegration property is set to true which allows application to use Node.js modules.

 

 

Then in the command line, you need to navigate to folder where your project is saved, then run the command:

 

 

This will start the ElectronJS application and display the window with Hello World  message.

This is very basic example, but it demonstrates the basic structure of an ElectronJS application. you can build on this example by adding more functionality and features to your application.

 

 

More on ElectronJS

 

 

 

This will be the result 

Introduction to ElectronJS
Introduction to ElectronJS

 

 

Note: Make sure that you have installed ElectronJS

 

Leave a Comment