SlideShare a Scribd company logo
Electron JS | Build cross-platform desktop applications with web technologies
Build cross platform desktop apps with JavaScript,
HTML, and CSS
Why we need ‘Desktop Applications’? [1/2]
3
● Secure
● To work ‘Offline’
○ On premises
○ We are ‘NOT CONSTANTLY CONNECTED’
● For professional level applications
○ Photoshop, AutoCAD etc.
● Hosting?
Why we need ‘Desktop Applications’? [2/2]
● Connect with peripheral devices & other local hardware
● Edit any local files
● Novice users - non tech savvy
4
Other Desktop App Development Tools
● JavaFX
● Qt
● Gtk+
● NW.js
● Kivy
● Lazarus
● Xojo
● Enyo
● Haxe
5
Electron JS | Build cross-platform desktop applications with web technologies
If you can build a website,
you can build a desktop app.
7
Electron
● Open source library
● Developed by GitHub - Led by Cheng Zhao
● Cross-platform desktop applications
● Use web technologies - HTML, CSS & JavaScript.
● Combines Chromium and Node.js into a single runtime
● Mac, Windows, and Linux
8
Atom Shell
Framework originally
written for Atom
GitHub's hackable text
editor
became
open-source Lorem ipsum dolor sit
amet, consectetur
Apps compatible with
Mac App Store
April 2013 May 2014 April 2015 May 2016 May 2016 August 2016
9
renamed as
Electron
Electron
v1.0.0
Windows Store
support
Why Electron?
10
● Electron enables you to create desktop applications
with pure JavaScript by providing a runtime with rich
native (operating system) APIs.
● Electron is NOT a JavaScript binding to GUI libraries.
● Electron uses web pages as its GUI
○ “Chromium browser, controlled by JavaScript”
● Electron App: Web pages running in a browser that can
leverage your OS APIs.
11
It takes care of the hard parts.
So you can focus on the core of your application
12
● Enable auto update
○ Squirrel/Squirrel.Windows - installation/update framework
● Native Components
○ Create native application menus and context menus,
dialogs, system tray & notifications etc.
● Crash reporting
○ Submit crash reports to a remote server.
● Debugging & Profiling
○ Collect tracing data from Chromium's content module for
finding performance bottlenecks and slow operations.
13
14
Apps built on Electron
Install Electron?
● Recommended: Install as a development dependency
○ Allows you to work on multiple apps with different Electron
versions
● Global Installation
● Proxies
● Custom Mirrors & Caches
● Customized
15
Install Electron as a development dependency
● npm
○ Package manager/ software registry
○ Open-source building blocks of code
(third party packages)
○ Install, update, share & distribute
● npm install --save-dev electron
16
Quick Start
● Create a new empty folder for your new Electron
application.
● Run npm init
● npm will guide you to create a basic package.json file
18
19
● Install electron:
○ npm install --save-dev electron
20
21
● Add a start script that instructs node to execute the
current package with electron runtime.
○ "start": "electron ."
22
Folder Structure
23
your-app/
|__packagage.json
|__main.js
|__index.html
1. package.json
{
"name": "your-app",
"version": "0.1.0",
"main": "main.js",
"scripts": {
"start": "electron ."
}
}
24
2. main.js
const {app, BrowserWindow} = require('electron')
function createWindow () {
// Create the browser window.
win = new BrowserWindow({width: 800, height: 600})
// and load the index.html of the app.
win.loadFile('index.html')
}
app.on('ready', createWindow)
25
3. index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
26
npm start
27
Architecture
28
Main Process
29
● Runs package.json's main script.
● The script that runs in the main process can display a
GUI by creating web pages.
● An Electron app always has one main process, but
never more.
Renderer Process
30
● Based on Chromium's multi-process architecture
● Electron uses Chromium for displaying web pages
● Each web page in Electron runs in its own process
31
● The main process creates web pages by creating
BrowserWindow instances.
● Each BrowserWindow instance runs the web page in its
own renderer process.
● When a BrowserWindow instance is destroyed, the
corresponding renderer process is also terminated.
32
● The main process manages all web pages and their
corresponding renderer processes.
● Each renderer process is isolated and only cares about
the web page running in it.
33
● In web pages, calling native GUI related APIs is not
allowed.
○ Managing native GUI resources in web pages is very
dangerous
○ It is easy to leak resources
● If you want to perform GUI operations in a web page,
the renderer process of the web page must
communicate with the main process to request that the
main process perform those operations.
34
Demo
36
Application Distribution
1. Download Electron's prebuilt binaries
2. Packaging
○ can be done manually
○ Third party packaging tool
■ electron-forge
■ electron-builder
■ Electron-packager
37
Pros [1/5]
● Electron Apps Are Similar to Web Apps
○ Relies entirely on web standards
■ HTML, CSS, JS
● Can focus on the core functionality
○ Electron already handles the hard part in software
development
38
Pros [2/5]
● Reuse of resources
○ Same team working on a web-application can easily
implement a desktop application.
○ Several things from the web-application can be
reused in the desktop app:
■ Business logic (services, helpers)
■ Design
■ General application structure
○ Saves time and money.
39
Pros [3/5]
● Chromium engine for rendering UI
○ Developer tools
■ Don’t have to think of an external debugger
■ easy to measure performance, conduct profiling or
detect memory leaks
○ Hot / Live reload
■ See changes instantly
○ Storage access
■ LocalStorage, SessionStorage, IndexedDB to persist
application state. 40
Pros [4/5]
● Provides various core functionalities:
○ Auto-update
○ crash reporter
○ installer creator
○ system-specific/native-ish features
■ Menu, system dialogs, file selection dialogs,
notifications, printer, etc
■ Shortcuts bindings
○ Open file manager & external links
○ Screenshots & PDF
41
Pros [5/5]
● Reuse of npm modules, out of the box
● No cross-browser compatibility issues
● No loading of remote assets (then no latency)
● Hardware Access
○ Keyboard shortcuts
42
Cons [1/2]
● JavaScript
● No built-in MVC
● Not as feature-rich or mature as NW.js
43
Cons [2/2]
● Size & Memory Usage!
○ Node JS + Chromium
○ Electrino - experimental featherweight alternative
● Cross Platform Builds?
○ If your app has native dependencies, it can be compiled only
on the target platform.
■ macOS code Signing works only on MacOS.
44
45
Sponsors
46
Resources for learning Electron
● electronjs.org/docs - all of Electron's documentation
● electron/electron-quick-start - a very basic starter Electron app
● electronjs.org/community#boilerplates - sample starter apps created
by the community
● electron/simple-samples - small applications with ideas for taking
them further
● electron/electron-api-demos - an Electron app that teaches you how
to use Electron
● hokein/electron-sample-apps - small demo apps for the various
Electron APIs
47
References
● https://electronjs.org/
● https://electronjs.org/docs/faq
● https://www.npmjs.com/package/electron
● https://slides.com/juliamaksimchik/electron-awesome
● https://www.tutorialspoint.com/electron/
● https://steemit.com/technology/@ryanbaer/getting-started-with-electron-pt-3-how
-the-hell-does-this-thing-work
● https://www.arroyolabs.com/2016/08/electron-and-cross-platform-applications/
● https://ourcodeworld.com/articles/read/259/how-to-connect-to-a-mysql-database
-in-electron-framework
48
Thank you!
Ad

More Related Content

What's hot (20)

Electron
ElectronElectron
Electron
Adrian Caetano
 
Electron presentation
Electron presentationElectron presentation
Electron presentation
StanislavNikolaenko2
 
Electron
ElectronElectron
Electron
Virginia Rodriguez
 
Electron - Build cross platform desktop apps
Electron - Build cross platform desktop appsElectron - Build cross platform desktop apps
Electron - Build cross platform desktop apps
Priyaranjan Mohanty
 
Getting started with Next.js
Getting started with Next.jsGetting started with Next.js
Getting started with Next.js
Gökhan Sarı
 
Introduction to MERN
Introduction to MERNIntroduction to MERN
Introduction to MERN
ShyamMohanKunwar
 
React native
React nativeReact native
React native
Vikrant Negi
 
React Native
React NativeReact Native
React Native
ASIMYILDIZ
 
Universal React apps in Next.js
Universal React apps in Next.jsUniversal React apps in Next.js
Universal React apps in Next.js
🐕 Łukasz Ostrowski
 
NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA  NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA
Pramendra Gupta
 
Introduction to Progressive Web App
Introduction to Progressive Web AppIntroduction to Progressive Web App
Introduction to Progressive Web App
Binh Bui
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react native
ModusJesus
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Sambhu Lakshmanan
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
Bojan Golubović
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Mern stack developement
Mern stack developementMern stack developement
Mern stack developement
kalyankumar836878
 
NextJS - Online Summit for Frontend Developers September 2020
NextJS - Online Summit for Frontend Developers September 2020NextJS - Online Summit for Frontend Developers September 2020
NextJS - Online Summit for Frontend Developers September 2020
Milad Heydari
 
Introduction to the Dart language
Introduction to the Dart languageIntroduction to the Dart language
Introduction to the Dart language
Jana Moudrá
 
Introduction to react native
Introduction to react nativeIntroduction to react native
Introduction to react native
Dani Akash
 
Intro to React
Intro to ReactIntro to React
Intro to React
Eric Westfall
 
Electron - Build cross platform desktop apps
Electron - Build cross platform desktop appsElectron - Build cross platform desktop apps
Electron - Build cross platform desktop apps
Priyaranjan Mohanty
 
Getting started with Next.js
Getting started with Next.jsGetting started with Next.js
Getting started with Next.js
Gökhan Sarı
 
NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA  NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA
Pramendra Gupta
 
Introduction to Progressive Web App
Introduction to Progressive Web AppIntroduction to Progressive Web App
Introduction to Progressive Web App
Binh Bui
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react native
ModusJesus
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Sambhu Lakshmanan
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
Bojan Golubović
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
NextJS - Online Summit for Frontend Developers September 2020
NextJS - Online Summit for Frontend Developers September 2020NextJS - Online Summit for Frontend Developers September 2020
NextJS - Online Summit for Frontend Developers September 2020
Milad Heydari
 
Introduction to the Dart language
Introduction to the Dart languageIntroduction to the Dart language
Introduction to the Dart language
Jana Moudrá
 
Introduction to react native
Introduction to react nativeIntroduction to react native
Introduction to react native
Dani Akash
 

Similar to Electron JS | Build cross-platform desktop applications with web technologies (20)

Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3
Opersys inc.
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSes
Mender.io
 
OVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source TreeOVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source Tree
Chang W. Doh
 
Leveraging Android's Linux Heritage
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux Heritage
Opersys inc.
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
Opersys inc.
 
Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011
Opersys inc.
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
Jody Garnett
 
Adding a GUI to Go
Adding a GUI to GoAdding a GUI to Go
Adding a GUI to Go
MatthiasNsner
 
DocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winnerDocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDoku
 
DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...
OW2
 
Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IV
Opersys inc.
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneurs
Rodrigo Gil
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
Dmytro Semenov
 
Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Introducing chrome apps (ogura)
Introducing chrome apps (ogura)
Kazuhiro Ogura
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
Julien Dubois
 
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Giovanni Toraldo
 
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering LabVoxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
Ron Munitz
 
Chromium: NaCl and Pepper API
Chromium: NaCl and Pepper APIChromium: NaCl and Pepper API
Chromium: NaCl and Pepper API
Chang W. Doh
 
Expedia 3x3 presentation
Expedia 3x3 presentationExpedia 3x3 presentation
Expedia 3x3 presentation
Drew Hannay
 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFMobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Niklas Heidloff
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3
Opersys inc.
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSes
Mender.io
 
OVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source TreeOVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source Tree
Chang W. Doh
 
Leveraging Android's Linux Heritage
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux Heritage
Opersys inc.
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
Opersys inc.
 
Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011
Opersys inc.
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
Jody Garnett
 
DocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winnerDocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDoku
 
DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...
OW2
 
Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IV
Opersys inc.
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneurs
Rodrigo Gil
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
Dmytro Semenov
 
Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Introducing chrome apps (ogura)
Introducing chrome apps (ogura)
Kazuhiro Ogura
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
Julien Dubois
 
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Giovanni Toraldo
 
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering LabVoxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
Ron Munitz
 
Chromium: NaCl and Pepper API
Chromium: NaCl and Pepper APIChromium: NaCl and Pepper API
Chromium: NaCl and Pepper API
Chang W. Doh
 
Expedia 3x3 presentation
Expedia 3x3 presentationExpedia 3x3 presentation
Expedia 3x3 presentation
Drew Hannay
 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFMobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Niklas Heidloff
 
Ad

More from Bethmi Gunasekara (6)

General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
Bethmi Gunasekara
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Bethmi Gunasekara
 
TestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingTestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit Testing
Bethmi Gunasekara
 
Html 5 - What's new?
Html 5 - What's new?Html 5 - What's new?
Html 5 - What's new?
Bethmi Gunasekara
 
No SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageNo SQL- The Future Of Data Storage
No SQL- The Future Of Data Storage
Bethmi Gunasekara
 
Web Portal for Construction Industry
Web Portal for Construction IndustryWeb Portal for Construction Industry
Web Portal for Construction Industry
Bethmi Gunasekara
 
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
Bethmi Gunasekara
 
TestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingTestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit Testing
Bethmi Gunasekara
 
No SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageNo SQL- The Future Of Data Storage
No SQL- The Future Of Data Storage
Bethmi Gunasekara
 
Web Portal for Construction Industry
Web Portal for Construction IndustryWeb Portal for Construction Industry
Web Portal for Construction Industry
Bethmi Gunasekara
 
Ad

Recently uploaded (20)

Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 

Electron JS | Build cross-platform desktop applications with web technologies

  • 2. Build cross platform desktop apps with JavaScript, HTML, and CSS
  • 3. Why we need ‘Desktop Applications’? [1/2] 3 ● Secure ● To work ‘Offline’ ○ On premises ○ We are ‘NOT CONSTANTLY CONNECTED’ ● For professional level applications ○ Photoshop, AutoCAD etc. ● Hosting?
  • 4. Why we need ‘Desktop Applications’? [2/2] ● Connect with peripheral devices & other local hardware ● Edit any local files ● Novice users - non tech savvy 4
  • 5. Other Desktop App Development Tools ● JavaFX ● Qt ● Gtk+ ● NW.js ● Kivy ● Lazarus ● Xojo ● Enyo ● Haxe 5
  • 7. If you can build a website, you can build a desktop app. 7
  • 8. Electron ● Open source library ● Developed by GitHub - Led by Cheng Zhao ● Cross-platform desktop applications ● Use web technologies - HTML, CSS & JavaScript. ● Combines Chromium and Node.js into a single runtime ● Mac, Windows, and Linux 8
  • 9. Atom Shell Framework originally written for Atom GitHub's hackable text editor became open-source Lorem ipsum dolor sit amet, consectetur Apps compatible with Mac App Store April 2013 May 2014 April 2015 May 2016 May 2016 August 2016 9 renamed as Electron Electron v1.0.0 Windows Store support
  • 11. ● Electron enables you to create desktop applications with pure JavaScript by providing a runtime with rich native (operating system) APIs. ● Electron is NOT a JavaScript binding to GUI libraries. ● Electron uses web pages as its GUI ○ “Chromium browser, controlled by JavaScript” ● Electron App: Web pages running in a browser that can leverage your OS APIs. 11
  • 12. It takes care of the hard parts. So you can focus on the core of your application 12
  • 13. ● Enable auto update ○ Squirrel/Squirrel.Windows - installation/update framework ● Native Components ○ Create native application menus and context menus, dialogs, system tray & notifications etc. ● Crash reporting ○ Submit crash reports to a remote server. ● Debugging & Profiling ○ Collect tracing data from Chromium's content module for finding performance bottlenecks and slow operations. 13
  • 14. 14 Apps built on Electron
  • 15. Install Electron? ● Recommended: Install as a development dependency ○ Allows you to work on multiple apps with different Electron versions ● Global Installation ● Proxies ● Custom Mirrors & Caches ● Customized 15
  • 16. Install Electron as a development dependency ● npm ○ Package manager/ software registry ○ Open-source building blocks of code (third party packages) ○ Install, update, share & distribute ● npm install --save-dev electron 16
  • 18. ● Create a new empty folder for your new Electron application. ● Run npm init ● npm will guide you to create a basic package.json file 18
  • 19. 19
  • 20. ● Install electron: ○ npm install --save-dev electron 20
  • 21. 21
  • 22. ● Add a start script that instructs node to execute the current package with electron runtime. ○ "start": "electron ." 22
  • 24. 1. package.json { "name": "your-app", "version": "0.1.0", "main": "main.js", "scripts": { "start": "electron ." } } 24
  • 25. 2. main.js const {app, BrowserWindow} = require('electron') function createWindow () { // Create the browser window. win = new BrowserWindow({width: 800, height: 600}) // and load the index.html of the app. win.loadFile('index.html') } app.on('ready', createWindow) 25
  • 26. 3. index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Hello World!</title> </head> <body> <h1>Hello World!</h1> </body> </html> 26
  • 29. Main Process 29 ● Runs package.json's main script. ● The script that runs in the main process can display a GUI by creating web pages. ● An Electron app always has one main process, but never more.
  • 30. Renderer Process 30 ● Based on Chromium's multi-process architecture ● Electron uses Chromium for displaying web pages ● Each web page in Electron runs in its own process
  • 31. 31 ● The main process creates web pages by creating BrowserWindow instances. ● Each BrowserWindow instance runs the web page in its own renderer process. ● When a BrowserWindow instance is destroyed, the corresponding renderer process is also terminated.
  • 32. 32 ● The main process manages all web pages and their corresponding renderer processes. ● Each renderer process is isolated and only cares about the web page running in it.
  • 33. 33 ● In web pages, calling native GUI related APIs is not allowed. ○ Managing native GUI resources in web pages is very dangerous ○ It is easy to leak resources ● If you want to perform GUI operations in a web page, the renderer process of the web page must communicate with the main process to request that the main process perform those operations.
  • 34. 34
  • 35. Demo
  • 36. 36
  • 37. Application Distribution 1. Download Electron's prebuilt binaries 2. Packaging ○ can be done manually ○ Third party packaging tool ■ electron-forge ■ electron-builder ■ Electron-packager 37
  • 38. Pros [1/5] ● Electron Apps Are Similar to Web Apps ○ Relies entirely on web standards ■ HTML, CSS, JS ● Can focus on the core functionality ○ Electron already handles the hard part in software development 38
  • 39. Pros [2/5] ● Reuse of resources ○ Same team working on a web-application can easily implement a desktop application. ○ Several things from the web-application can be reused in the desktop app: ■ Business logic (services, helpers) ■ Design ■ General application structure ○ Saves time and money. 39
  • 40. Pros [3/5] ● Chromium engine for rendering UI ○ Developer tools ■ Don’t have to think of an external debugger ■ easy to measure performance, conduct profiling or detect memory leaks ○ Hot / Live reload ■ See changes instantly ○ Storage access ■ LocalStorage, SessionStorage, IndexedDB to persist application state. 40
  • 41. Pros [4/5] ● Provides various core functionalities: ○ Auto-update ○ crash reporter ○ installer creator ○ system-specific/native-ish features ■ Menu, system dialogs, file selection dialogs, notifications, printer, etc ■ Shortcuts bindings ○ Open file manager & external links ○ Screenshots & PDF 41
  • 42. Pros [5/5] ● Reuse of npm modules, out of the box ● No cross-browser compatibility issues ● No loading of remote assets (then no latency) ● Hardware Access ○ Keyboard shortcuts 42
  • 43. Cons [1/2] ● JavaScript ● No built-in MVC ● Not as feature-rich or mature as NW.js 43
  • 44. Cons [2/2] ● Size & Memory Usage! ○ Node JS + Chromium ○ Electrino - experimental featherweight alternative ● Cross Platform Builds? ○ If your app has native dependencies, it can be compiled only on the target platform. ■ macOS code Signing works only on MacOS. 44
  • 45. 45
  • 47. Resources for learning Electron ● electronjs.org/docs - all of Electron's documentation ● electron/electron-quick-start - a very basic starter Electron app ● electronjs.org/community#boilerplates - sample starter apps created by the community ● electron/simple-samples - small applications with ideas for taking them further ● electron/electron-api-demos - an Electron app that teaches you how to use Electron ● hokein/electron-sample-apps - small demo apps for the various Electron APIs 47
  • 48. References ● https://electronjs.org/ ● https://electronjs.org/docs/faq ● https://www.npmjs.com/package/electron ● https://slides.com/juliamaksimchik/electron-awesome ● https://www.tutorialspoint.com/electron/ ● https://steemit.com/technology/@ryanbaer/getting-started-with-electron-pt-3-how -the-hell-does-this-thing-work ● https://www.arroyolabs.com/2016/08/electron-and-cross-platform-applications/ ● https://ourcodeworld.com/articles/read/259/how-to-connect-to-a-mysql-database -in-electron-framework 48