SlideShare a Scribd company logo
JavaScript and desktop apps
Short introduction to Electron environment
Piotr Kowalski
CTO@Brainhub
JavaScript ?
http://www.lingscars.com
// Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello
World to all requests.
var server = http.createServer(function (request,
response) {
response.writeHead(200, {"Content-Type":
"text/plain"});
response.end("Hello Worldn");
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(8000);
// Put a friendly message on the terminal
console.log("Server running at
http://127.0.0.1:8000/");
https://howtonode.org/hello-node
https://msdn.microsoft.com/en-us/library/bb384843.aspx
https://richnewman.wordpress.com/category/tabbed-document-interface/
JavaScript and Desktop Apps - Introduction to Electron
ELECTRON!
OK, but how to start?
Necessary packages
npm install --save electron
Main process
Node API
Creating windows
Renderer process
UI
HTML
CSS
JavaScript
IPC
Resources extensive
tasks
Resources extensive
tasks
Creating windows
Main process
Node API
Renderer process
UI
HTML
CSS
JavaScript
IPC
Renderer process
Renderer process
Renderer process
app.js
const app = require('electron').app;
const createWindow = require('./createWindow.js');
app.on('ready', createWindow);
app.on('window-all-closed', function() {
app.quit();
});
createWindow.js
const BrowserWindow = require('electron').BrowserWindow;
const path = require('path');
const url = require('url');
let mainWindow = null;
module.exports = function createWindow() {
mainWindow = new BrowserWindow({width: 1024, height: 768});
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true,
}));
mainWindow.webContents.openDevTools();
mainWindow.on('closed', function() {
mainWindow = null;
});
};
module.exports.mainWindow = mainWindow;
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8”>
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<button id=”some-button”></button>
<div id=”some-div”></div>
</body>
<script>
require(‘./renderer.js’);
</script>
</html>
renderer.js
// react, knockout, favorite framework :)
renderer.js
// react, knockout, favorite framework :)
// COMMUNICATION with main process!
IPC - demo
Native modules in Electron
https://nodejs.org/en/download/releases/
Necessary packages
npm install --save-dev electron-rebuild
./node_modules/.bin/electron-rebuild
Distributing the app
Necessary packages
npm install --global electron-packager
electron-packager dist
Electron API
Electron API
● Accelerator
● app
● autoUpdater
● BrowserWindow
● clipboard
● Cookies
● crashReporter
● desktopCapturer
● dialog
● DownloadItem
● EnvironmentVariables
● globalShortcut
● ipcMain/ipcRenderer
● Locales
● Menu, MenuItem
● net
● powerMonitor
● process
● systemPreferences
● Tray
Thank you! :)

More Related Content

What's hot (20)

PDF
Building Cross Platform Apps with Electron
Chris Ward
 
PPTX
Desktop Apps in a Javascript World - Electron
Marc MacLeod
 
PPTX
Electron
Jens Siebert
 
PDF
Building Native Experiences with Electron
Ben Gotow
 
PPTX
Selenium Tutorial for Beginners - TIB Academy
TIB Academy
 
PDF
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DEVCON
 
PDF
Xcode Server & Xcode 7 Bots
Steven Forbes
 
PDF
Vagrant development environment
Hiraq Citra M
 
PDF
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
Badoo
 
PDF
Web workers
Surbhi Mathur
 
PDF
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Eddie Lau
 
PPTX
Selenium training for beginners
TIB Academy
 
PPTX
An overview of mobile html + java script frameworks
Sasha dos Santos
 
PDF
The current state of web
Ritesh Kumar
 
PPTX
Building an Ionic hybrid mobile app with TypeScript
Serge van den Oever
 
PDF
iOS Parallel Automation - Viktar Karanevich - Mobile Test Automation Meetup (...
Badoo
 
KEY
Getting Started with HTML 5 Web workers
Flumes
 
PDF
Going Desktop with Electron
Leo Lindhorst
 
PDF
React Native: The Development Flow
Ritesh Kumar
 
PDF
PowerShell for SharePoint Developers
Boulos Dib
 
Building Cross Platform Apps with Electron
Chris Ward
 
Desktop Apps in a Javascript World - Electron
Marc MacLeod
 
Electron
Jens Siebert
 
Building Native Experiences with Electron
Ben Gotow
 
Selenium Tutorial for Beginners - TIB Academy
TIB Academy
 
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DEVCON
 
Xcode Server & Xcode 7 Bots
Steven Forbes
 
Vagrant development environment
Hiraq Citra M
 
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
Badoo
 
Web workers
Surbhi Mathur
 
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Eddie Lau
 
Selenium training for beginners
TIB Academy
 
An overview of mobile html + java script frameworks
Sasha dos Santos
 
The current state of web
Ritesh Kumar
 
Building an Ionic hybrid mobile app with TypeScript
Serge van den Oever
 
iOS Parallel Automation - Viktar Karanevich - Mobile Test Automation Meetup (...
Badoo
 
Getting Started with HTML 5 Web workers
Flumes
 
Going Desktop with Electron
Leo Lindhorst
 
React Native: The Development Flow
Ritesh Kumar
 
PowerShell for SharePoint Developers
Boulos Dib
 

Similar to JavaScript and Desktop Apps - Introduction to Electron (20)

PPTX
Electron - cross platform desktop applications made easy
Ulrich Krause
 
PDF
Building desktop applications for fun with electron
TMME - TECH MEETUP FOR MYANMAR ENGINEERS IN JP
 
PDF
Electron Firenze 2020: Linux, Windows o MacOS?
Denny Biasiolli
 
PDF
Electron: Linux, Windows or Macos?
Commit University
 
PPTX
Cross-platform Desktop Apps development using HTML, CSS, JS with Electron
Esinniobiwa Quareeb
 
PDF
An overview of the architecture of electron.js
Moon Technolabs Pvt. Ltd.
 
PPTX
SubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
Binary Studio
 
DOCX
Basics of node.js
Yasir Wani
 
PDF
Desktop apps with Electron... for fun and profit
Dhaya B.
 
PPTX
Bringing Javascript to the Desktop with Electron
Nir Noy
 
PPTX
Learn Electron for Web Developers
Kyle Cearley
 
PDF
Electron: From Beginner to Pro
Chris Griffith
 
PDF
Electron
Debopam Sengupta
 
PDF
Electron
ITCP Community
 
PPTX
Introduction to node
girish82
 
PDF
Node.js introduction
Parth Joshi
 
PDF
Electron presentation
StanislavNikolaenko2
 
PDF
Electron JS | Build cross-platform desktop applications with web technologies
Bethmi Gunasekara
 
PPTX
Nodejs
Vinod Kumar Marupu
 
PPTX
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
Electron - cross platform desktop applications made easy
Ulrich Krause
 
Building desktop applications for fun with electron
TMME - TECH MEETUP FOR MYANMAR ENGINEERS IN JP
 
Electron Firenze 2020: Linux, Windows o MacOS?
Denny Biasiolli
 
Electron: Linux, Windows or Macos?
Commit University
 
Cross-platform Desktop Apps development using HTML, CSS, JS with Electron
Esinniobiwa Quareeb
 
An overview of the architecture of electron.js
Moon Technolabs Pvt. Ltd.
 
SubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
Binary Studio
 
Basics of node.js
Yasir Wani
 
Desktop apps with Electron... for fun and profit
Dhaya B.
 
Bringing Javascript to the Desktop with Electron
Nir Noy
 
Learn Electron for Web Developers
Kyle Cearley
 
Electron: From Beginner to Pro
Chris Griffith
 
Electron
ITCP Community
 
Introduction to node
girish82
 
Node.js introduction
Parth Joshi
 
Electron presentation
StanislavNikolaenko2
 
Electron JS | Build cross-platform desktop applications with web technologies
Bethmi Gunasekara
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
Ad

More from Brainhub (20)

PDF
Czy jest alternatywa dla chmury?
Brainhub
 
PDF
Jak zostać Dev w DevOps? O zwiększaniu niezależności zespołów developerskich ...
Brainhub
 
PDF
AWS – jak rozpocząć przygodę z chmurą?
Brainhub
 
PDF
Konfiguracja GitLab CI/CD pipelines od podstaw
Brainhub
 
PDF
tRPC - czy to koniec GraphQL?
Brainhub
 
PDF
Solid.js - następca Reacta?
Brainhub
 
PDF
Struktury algebraiczne w JavaScripcie
Brainhub
 
PDF
WebAssembly - czy dzisiaj mi się to przyda do pracy?
Brainhub
 
PDF
Ewoluowanie neuronowych mózgów w JavaScript, wielowątkowo!
Brainhub
 
PDF
Go home TypeScript, you're drunk!
Brainhub
 
PDF
How I taught the messenger to tell lame jokes
Brainhub
 
PDF
The hunt of the unicorn, to capture productivity
Brainhub
 
PPTX
TDD in the wild
Brainhub
 
PDF
WebAssembly - kolejny buzzword, czy (r)ewolucja?
Brainhub
 
PDF
React performance
Brainhub
 
PDF
Introduction to RxJS
Brainhub
 
PDF
React Native in a nutshell
Brainhub
 
PDF
Ant Colony Optimization (Heuristic algorithms & Swarm intelligence)
Brainhub
 
PDF
Technologia, a Startup - Brainhub
Brainhub
 
PDF
Introduction to GraphQL
Brainhub
 
Czy jest alternatywa dla chmury?
Brainhub
 
Jak zostać Dev w DevOps? O zwiększaniu niezależności zespołów developerskich ...
Brainhub
 
AWS – jak rozpocząć przygodę z chmurą?
Brainhub
 
Konfiguracja GitLab CI/CD pipelines od podstaw
Brainhub
 
tRPC - czy to koniec GraphQL?
Brainhub
 
Solid.js - następca Reacta?
Brainhub
 
Struktury algebraiczne w JavaScripcie
Brainhub
 
WebAssembly - czy dzisiaj mi się to przyda do pracy?
Brainhub
 
Ewoluowanie neuronowych mózgów w JavaScript, wielowątkowo!
Brainhub
 
Go home TypeScript, you're drunk!
Brainhub
 
How I taught the messenger to tell lame jokes
Brainhub
 
The hunt of the unicorn, to capture productivity
Brainhub
 
TDD in the wild
Brainhub
 
WebAssembly - kolejny buzzword, czy (r)ewolucja?
Brainhub
 
React performance
Brainhub
 
Introduction to RxJS
Brainhub
 
React Native in a nutshell
Brainhub
 
Ant Colony Optimization (Heuristic algorithms & Swarm intelligence)
Brainhub
 
Technologia, a Startup - Brainhub
Brainhub
 
Introduction to GraphQL
Brainhub
 
Ad

Recently uploaded (20)

PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 

JavaScript and Desktop Apps - Introduction to Electron