SlideShare uma empresa Scribd logo
1 de 29
© Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
SELA DEVELOPER PRACTICE
JUNE 19-23, 2016
Nir Noy
Consultant, Web, Sela
@noynir
Bringing Javascript to the Desktop with Electron
Why Desktop?
Offline
Local hardware
(printers, devices etc…)
Security
On-premise
App store
Local Access
Kiosk
It Just ”Feels Right”
Desktop Apps
Development Tools
Tasks
Media players
Email client
Calendar
Time management
Mapping
Social media clients
File management
Backup
Audio and Video Conferencing
Gaming
What is Electron
A framework for building cross
platform Desktop Applications
using web technologies
What is Electron
Created by GitHub as the shell
for the Atom text editor.
Road to Electron
Chromium
Embedded
Framework
NW.JS
What’s Under the Hood
NodeJS Chromium
Cool Stuff
Web Technologies – No Native Skills needed
Javascript, HTML, CSS only.
One Browser
Chrome compatible only
Latest Features – ES 2015 & Chrome goodies.
Built-In NodeJS
All Node Capabilities - File system, networking etc..
npm ecosystem
Cross platform
Packaging for Windows, OS X, Linux
Native UX
Native Dialogs, Menus, Notifications etc…
Uncool Stuff
Web Technologies
Seriously it’s Javascript, HTML and CSS all the way.
Native Modules
Native Modules are written in C/C++ .
Debugging
Certain parts of the application are hard to debug.
Tooling
Some of the tooling is immature.
How Does it Work?
A Tale Of Two processes
A Tale Of Two processes
Main
Application lifecycle
Browser window ipc
Node.js menu dialog
Renderer
Web page
ipc webFrame
Node.js
DOM remote
Creates
A Tale Of Two processes
Main
Application lifecycle
Browser window ipc
Node.js menu dialog
Renderer
Web page
ipc webFrame
Node.js
DOM remote
Creates
A Tale Of Two processes
Main
Application lifecycle
Renderer
Web page
Renderer
Web page
Renderer
Background Worker
Getting Started
Hello Electron App
Getting Started
Create a main.js file
...
app.on('ready',() => {
mainWindow=new BrowserWindow({width:800, height:600});
mainWindow.loadURL('file://'+ __dirname +'/index.html');
mainWindow.on('closed',function(){
mainWindow=null;
});
});
app.on('window-all-closed',() => {
if (process.platform != 'darwin') { app.quit(); }
});
Getting Started
Create an index.html file
...
<body>
<h1>Hello Electron!</h1>
We are using node
<script>
var dv=document.createElement('div');
dv.innerHTML=`We are using node ${process.versions.node}
<br/>Chrome ${process.versions.chrome}<br/>
Electron ${process.versions.electron}`;
document.body.appendChild(dv);
</script>
</body>
...
Project Setup
Create a Package.json file
{
"name" : "your-app",
"version" : "0.1.0",
"main" : "main.js"
}
Running Your App
Install Electron prebuilt binaries using npm.
$ npm install electron-prebuilt --save-dev // -g
Run your app with the Electron Command
$ electron your-app/
Demo
Hello Electron
Processes Communication
The Main and Renderer Processes can communicate using their
ipc modules.
Each type of processes has it’s own ipc module.
In the Renderer process use the ipcRenderer module to send
and listen to messages
const ipcRenderer = require('electron').ipcRenderer; ipcRenderer.on('asynchronous-
reply', function(event, arg) { console.log(arg); // prints "pong"
});
ipcRenderer.send('asynchronous-message', 'ping');
Processes Communication
In the Main process use the ipcMain module to listen and reply
to messages.
const ipcMain = require('electron').ipcMain;
ipcMain.on('asynchronous-message', function(event, arg) {
console.log(arg); // prints "ping"
event.sender.send('asynchronous-reply', 'pong');
});
Processes Communication
The remote module provides a simple way to do inter-process
communication (IPC) between the renderer process (web page) and
the main process.
It allow method invocation 0f main process objects without explicitly
using the ipc modules.
const remote = require('electron').remote;
const BrowserWindow = remote.BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
win.loadURL('https://github.com');
Demo
Advanced Demo
Packaging and Distributing
Install Electron packager using npm.
$ npm install electron-packager --save-dev / -g
Run your app with the Electron Command
$ electron-packager app-name
--platform=win32
--arch=x64
Built With Electron
Visual Studio Code
Atom
SlackWhat’s App
Electron Tools
Electron API Demos app
Electron App for interactively exploring the Electron API.
Devtron
Electron Extension for Chrome’s Devtools.
Allow inspection and monitoring of your app.
Spectron
Framework for writing integrations tests.
Built on top of ChromeDriver and WebDriverIO.
Community Electron Tools & Resources
electron-builder - Create installers.
electron-boilerplate
generator-electron - yeoman generator
Awesome electron
https://github.com/sindresorhus/awesome-electron
Questions
Thank you
Nir Noy | @noynir | nirn@sela.co.il
https://github.com/noynir/ElectronExamples

Mais conteúdo relacionado

Mais procurados

Getting started with .net on openSUSE (asp.net with c#)
Getting started with .net on openSUSE  (asp.net with c#)Getting started with .net on openSUSE  (asp.net with c#)
Getting started with .net on openSUSE (asp.net with c#)Alin Alifah
 
Docker Tooling for Eclipse
Docker Tooling for EclipseDocker Tooling for Eclipse
Docker Tooling for EclipseMax Andersen
 
Introduction to Express and Grunt
Introduction to Express and GruntIntroduction to Express and Grunt
Introduction to Express and GruntPeter deHaan
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels Docker, Inc.
 
Using Minikube for Node.js development
Using Minikube for Node.js developmentUsing Minikube for Node.js development
Using Minikube for Node.js developmentTroy Connor
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Milindu Sanoj Kumarage
 
Production Ready Javascript With Grunt
Production Ready Javascript With GruntProduction Ready Javascript With Grunt
Production Ready Javascript With GruntXB Software, Ltd.
 
Dockerize WordPress on Mac/Windows
Dockerize WordPress on Mac/WindowsDockerize WordPress on Mac/Windows
Dockerize WordPress on Mac/WindowsKite Koga
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerJürgen Gutsch
 
Preprocessor Workflow with Grunt
Preprocessor Workflow with GruntPreprocessor Workflow with Grunt
Preprocessor Workflow with GruntVlad Filippov
 
Frasco: Jekyll Starter Project
Frasco: Jekyll Starter ProjectFrasco: Jekyll Starter Project
Frasco: Jekyll Starter ProjectKite Koga
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeDocker, Inc.
 
Infrastructure development on windows ldn cd meetup
Infrastructure development on windows   ldn cd meetup Infrastructure development on windows   ldn cd meetup
Infrastructure development on windows ldn cd meetup Owain Perry
 
Docker, developers take power
Docker, developers take powerDocker, developers take power
Docker, developers take powerEnalean
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPuppet
 
Front-end development automation with Grunt
Front-end development automation with GruntFront-end development automation with Grunt
Front-end development automation with Gruntbenko
 
Generating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLsGenerating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLsKarsten Thoms
 

Mais procurados (20)

Getting started with .net on openSUSE (asp.net with c#)
Getting started with .net on openSUSE  (asp.net with c#)Getting started with .net on openSUSE  (asp.net with c#)
Getting started with .net on openSUSE (asp.net with c#)
 
Docker Tooling for Eclipse
Docker Tooling for EclipseDocker Tooling for Eclipse
Docker Tooling for Eclipse
 
Grunt and Bower
Grunt and BowerGrunt and Bower
Grunt and Bower
 
Introduction to Express and Grunt
Introduction to Express and GruntIntroduction to Express and Grunt
Introduction to Express and Grunt
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels
 
Using Minikube for Node.js development
Using Minikube for Node.js developmentUsing Minikube for Node.js development
Using Minikube for Node.js development
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!
 
Production Ready Javascript With Grunt
Production Ready Javascript With GruntProduction Ready Javascript With Grunt
Production Ready Javascript With Grunt
 
Dockerize WordPress on Mac/Windows
Dockerize WordPress on Mac/WindowsDockerize WordPress on Mac/Windows
Dockerize WordPress on Mac/Windows
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & docker
 
Preprocessor Workflow with Grunt
Preprocessor Workflow with GruntPreprocessor Workflow with Grunt
Preprocessor Workflow with Grunt
 
Frasco: Jekyll Starter Project
Frasco: Jekyll Starter ProjectFrasco: Jekyll Starter Project
Frasco: Jekyll Starter Project
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and Compose
 
Jenkins Job DSL plugin
Jenkins Job DSL plugin Jenkins Job DSL plugin
Jenkins Job DSL plugin
 
Yeoman + Grunt + Bower - Google I/O Rewind Sri Lanka
Yeoman + Grunt + Bower - Google I/O Rewind Sri Lanka Yeoman + Grunt + Bower - Google I/O Rewind Sri Lanka
Yeoman + Grunt + Bower - Google I/O Rewind Sri Lanka
 
Infrastructure development on windows ldn cd meetup
Infrastructure development on windows   ldn cd meetup Infrastructure development on windows   ldn cd meetup
Infrastructure development on windows ldn cd meetup
 
Docker, developers take power
Docker, developers take powerDocker, developers take power
Docker, developers take power
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with Chocolatey
 
Front-end development automation with Grunt
Front-end development automation with GruntFront-end development automation with Grunt
Front-end development automation with Grunt
 
Generating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLsGenerating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLs
 

Semelhante a Bringing Javascript to the Desktop with Electron

Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyUlrich Krause
 
Electron Firenze 2020: Linux, Windows o MacOS?
Electron Firenze 2020: Linux, Windows o MacOS?Electron Firenze 2020: Linux, Windows o MacOS?
Electron Firenze 2020: Linux, Windows o MacOS?Denny Biasiolli
 
Electron: Linux, Windows or Macos?
Electron: Linux, Windows or Macos?Electron: Linux, Windows or Macos?
Electron: Linux, Windows or Macos?Commit University
 
Going Desktop with Electron
Going Desktop with ElectronGoing Desktop with Electron
Going Desktop with ElectronLeo Lindhorst
 
Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!*instinctools
 
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Fwdays
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Lars Vogel
 
Native client
Native clientNative client
Native clientzyc901016
 
WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014Minko3D
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tourcacois
 
Minko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.jsMinko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.jsMinko3D
 

Semelhante a Bringing Javascript to the Desktop with Electron (20)

Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
 
Electron Firenze 2020: Linux, Windows o MacOS?
Electron Firenze 2020: Linux, Windows o MacOS?Electron Firenze 2020: Linux, Windows o MacOS?
Electron Firenze 2020: Linux, Windows o MacOS?
 
Electron: Linux, Windows or Macos?
Electron: Linux, Windows or Macos?Electron: Linux, Windows or Macos?
Electron: Linux, Windows or Macos?
 
Going Desktop with Electron
Going Desktop with ElectronGoing Desktop with Electron
Going Desktop with Electron
 
Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!
 
Taking The Cloud Native
Taking The Cloud NativeTaking The Cloud Native
Taking The Cloud Native
 
Electron
ElectronElectron
Electron
 
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
 
Proposal
ProposalProposal
Proposal
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
.NET Core on Mac
.NET Core on Mac.NET Core on Mac
.NET Core on Mac
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11
 
Native client
Native clientNative client
Native client
 
Intro to Android Programming
Intro to Android ProgrammingIntro to Android Programming
Intro to Android Programming
 
Electron presentation
Electron presentationElectron presentation
Electron presentation
 
WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014
 
SynapseIndia dotnet development framework
SynapseIndia  dotnet development frameworkSynapseIndia  dotnet development framework
SynapseIndia dotnet development framework
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
Building desktop applications for fun with electron
Building desktop applications for fun with electronBuilding desktop applications for fun with electron
Building desktop applications for fun with electron
 
Minko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.jsMinko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.js
 

Último

Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 

Último (20)

Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 

Bringing Javascript to the Desktop with Electron

  • 1. © Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com SELA DEVELOPER PRACTICE JUNE 19-23, 2016 Nir Noy Consultant, Web, Sela @noynir Bringing Javascript to the Desktop with Electron
  • 2. Why Desktop? Offline Local hardware (printers, devices etc…) Security On-premise App store Local Access Kiosk It Just ”Feels Right”
  • 3. Desktop Apps Development Tools Tasks Media players Email client Calendar Time management Mapping Social media clients File management Backup Audio and Video Conferencing Gaming
  • 4. What is Electron A framework for building cross platform Desktop Applications using web technologies
  • 5. What is Electron Created by GitHub as the shell for the Atom text editor.
  • 7. What’s Under the Hood NodeJS Chromium
  • 8. Cool Stuff Web Technologies – No Native Skills needed Javascript, HTML, CSS only. One Browser Chrome compatible only Latest Features – ES 2015 & Chrome goodies. Built-In NodeJS All Node Capabilities - File system, networking etc.. npm ecosystem Cross platform Packaging for Windows, OS X, Linux Native UX Native Dialogs, Menus, Notifications etc…
  • 9. Uncool Stuff Web Technologies Seriously it’s Javascript, HTML and CSS all the way. Native Modules Native Modules are written in C/C++ . Debugging Certain parts of the application are hard to debug. Tooling Some of the tooling is immature.
  • 10. How Does it Work? A Tale Of Two processes
  • 11. A Tale Of Two processes Main Application lifecycle Browser window ipc Node.js menu dialog Renderer Web page ipc webFrame Node.js DOM remote Creates
  • 12. A Tale Of Two processes Main Application lifecycle Browser window ipc Node.js menu dialog Renderer Web page ipc webFrame Node.js DOM remote Creates
  • 13. A Tale Of Two processes Main Application lifecycle Renderer Web page Renderer Web page Renderer Background Worker
  • 15. Getting Started Create a main.js file ... app.on('ready',() => { mainWindow=new BrowserWindow({width:800, height:600}); mainWindow.loadURL('file://'+ __dirname +'/index.html'); mainWindow.on('closed',function(){ mainWindow=null; }); }); app.on('window-all-closed',() => { if (process.platform != 'darwin') { app.quit(); } });
  • 16. Getting Started Create an index.html file ... <body> <h1>Hello Electron!</h1> We are using node <script> var dv=document.createElement('div'); dv.innerHTML=`We are using node ${process.versions.node} <br/>Chrome ${process.versions.chrome}<br/> Electron ${process.versions.electron}`; document.body.appendChild(dv); </script> </body> ...
  • 17. Project Setup Create a Package.json file { "name" : "your-app", "version" : "0.1.0", "main" : "main.js" }
  • 18. Running Your App Install Electron prebuilt binaries using npm. $ npm install electron-prebuilt --save-dev // -g Run your app with the Electron Command $ electron your-app/
  • 20. Processes Communication The Main and Renderer Processes can communicate using their ipc modules. Each type of processes has it’s own ipc module. In the Renderer process use the ipcRenderer module to send and listen to messages const ipcRenderer = require('electron').ipcRenderer; ipcRenderer.on('asynchronous- reply', function(event, arg) { console.log(arg); // prints "pong" }); ipcRenderer.send('asynchronous-message', 'ping');
  • 21. Processes Communication In the Main process use the ipcMain module to listen and reply to messages. const ipcMain = require('electron').ipcMain; ipcMain.on('asynchronous-message', function(event, arg) { console.log(arg); // prints "ping" event.sender.send('asynchronous-reply', 'pong'); });
  • 22. Processes Communication The remote module provides a simple way to do inter-process communication (IPC) between the renderer process (web page) and the main process. It allow method invocation 0f main process objects without explicitly using the ipc modules. const remote = require('electron').remote; const BrowserWindow = remote.BrowserWindow; var win = new BrowserWindow({ width: 800, height: 600 }); win.loadURL('https://github.com');
  • 24. Packaging and Distributing Install Electron packager using npm. $ npm install electron-packager --save-dev / -g Run your app with the Electron Command $ electron-packager app-name --platform=win32 --arch=x64
  • 25. Built With Electron Visual Studio Code Atom SlackWhat’s App
  • 26. Electron Tools Electron API Demos app Electron App for interactively exploring the Electron API. Devtron Electron Extension for Chrome’s Devtools. Allow inspection and monitoring of your app. Spectron Framework for writing integrations tests. Built on top of ChromeDriver and WebDriverIO.
  • 27. Community Electron Tools & Resources electron-builder - Create installers. electron-boilerplate generator-electron - yeoman generator Awesome electron https://github.com/sindresorhus/awesome-electron
  • 29. Thank you Nir Noy | @noynir | nirn@sela.co.il https://github.com/noynir/ElectronExamples